Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1042)

Side by Side Diff: chrome/browser/ui/apps/app_metro_infobar_delegate_win.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/apps/app_metro_infobar_delegate_win.h" 5 #include "chrome/browser/ui/apps/app_metro_infobar_delegate_win.h"
6 6
7 #include "apps/app_launch_for_metro_restart_win.h" 7 #include "apps/app_launch_for_metro_restart_win.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/infobars/infobar.h"
13 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/lifetime/application_lifetime.h" 14 #include "chrome/browser/lifetime/application_lifetime.h"
13 #include "chrome/browser/metro_utils/metro_chrome_win.h" 15 #include "chrome/browser/metro_utils/metro_chrome_win.h"
14 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/app_list/app_list_icon_win.h" 17 #include "chrome/browser/ui/app_list/app_list_icon_win.h"
16 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_finder.h" 19 #include "chrome/browser/ui/browser_finder.h"
18 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/host_desktop.h" 21 #include "chrome/browser/ui/host_desktop.h"
20 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
21 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
(...skipping 13 matching lines...) Expand all
35 37
36 // Chrome should never get here via the Ash desktop, so only look for browsers 38 // Chrome should never get here via the Ash desktop, so only look for browsers
37 // on the native desktop. 39 // on the native desktop.
38 Browser* browser = FindOrCreateTabbedBrowser( 40 Browser* browser = FindOrCreateTabbedBrowser(
39 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); 41 profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
40 42
41 // Create a new tab at about:blank, and add the infobar. 43 // Create a new tab at about:blank, and add the infobar.
42 content::WebContents* web_contents = browser->OpenURL(content::OpenURLParams( 44 content::WebContents* web_contents = browser->OpenURL(content::OpenURLParams(
43 GURL(content::kAboutBlankURL), content::Referrer(), NEW_FOREGROUND_TAB, 45 GURL(content::kAboutBlankURL), content::Referrer(), NEW_FOREGROUND_TAB,
44 content::PAGE_TRANSITION_LINK, false)); 46 content::PAGE_TRANSITION_LINK, false));
45 InfoBarService* info_bar_service = 47 InfoBarService::FromWebContents(web_contents)->AddInfoBar(
46 InfoBarService::FromWebContents(web_contents); 48 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
47 info_bar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( 49 new AppMetroInfoBarDelegateWin(mode, extension_id))));
48 new AppMetroInfoBarDelegateWin(info_bar_service, mode, extension_id)));
49 50
50 // Use PostTask because we can get here in a COM SendMessage, and 51 // Use PostTask because we can get here in a COM SendMessage, and
51 // ActivateApplication can not be sent nested (returns error 52 // ActivateApplication can not be sent nested (returns error
52 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL). 53 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL).
53 base::MessageLoop::current()->PostTask( 54 base::MessageLoop::current()->PostTask(
54 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); 55 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome)));
55 } 56 }
56 57
57 AppMetroInfoBarDelegateWin::AppMetroInfoBarDelegateWin( 58 AppMetroInfoBarDelegateWin::AppMetroInfoBarDelegateWin(
58 InfoBarService* info_bar_service,
59 Mode mode, 59 Mode mode,
60 const std::string& extension_id) 60 const std::string& extension_id)
61 : ConfirmInfoBarDelegate(info_bar_service), 61 : ConfirmInfoBarDelegate(),
62 mode_(mode), 62 mode_(mode),
63 extension_id_(extension_id) { 63 extension_id_(extension_id) {
64 DCHECK_EQ(mode_ == SHOW_APP_LIST, extension_id_.empty()); 64 DCHECK_EQ(mode_ == SHOW_APP_LIST, extension_id_.empty());
65 } 65 }
66 66
67 AppMetroInfoBarDelegateWin::~AppMetroInfoBarDelegateWin() {} 67 AppMetroInfoBarDelegateWin::~AppMetroInfoBarDelegateWin() {}
68 68
69 int AppMetroInfoBarDelegateWin::GetIconID() const { 69 int AppMetroInfoBarDelegateWin::GetIconID() const {
70 return GetAppListIconResourceId(); 70 return GetAppListIconResourceId();
71 } 71 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 bool AppMetroInfoBarDelegateWin::LinkClicked( 110 bool AppMetroInfoBarDelegateWin::LinkClicked(
111 WindowOpenDisposition disposition) { 111 WindowOpenDisposition disposition) {
112 web_contents()->OpenURL(content::OpenURLParams( 112 web_contents()->OpenURL(content::OpenURLParams(
113 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"), 113 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"),
114 content::Referrer(), 114 content::Referrer(),
115 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 115 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
116 content::PAGE_TRANSITION_LINK, false)); 116 content::PAGE_TRANSITION_LINK, false));
117 return false; 117 return false;
118 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698