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

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 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 "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/apps/app_launch_for_metro_restart_win.h" 10 #include "chrome/browser/apps/app_launch_for_metro_restart_win.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_window.h" 19 #include "chrome/browser/ui/browser_window.h"
18 #include "chrome/browser/ui/host_desktop.h" 20 #include "chrome/browser/ui/host_desktop.h"
19 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.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 14 matching lines...) Expand all
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 chrome::ScopedTabbedBrowserDisplayer displayer( 40 chrome::ScopedTabbedBrowserDisplayer displayer(
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::OpenURLParams params(GURL(content::kAboutBlankURL), 44 content::OpenURLParams params(GURL(content::kAboutBlankURL),
43 content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, 45 content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK,
44 false); 46 false);
45 content::WebContents* web_contents = displayer.browser()->OpenURL(params); 47 content::WebContents* web_contents = displayer.browser()->OpenURL(params);
46 InfoBarService* info_bar_service = 48 InfoBarService::FromWebContents(web_contents)->AddInfoBar(
47 InfoBarService::FromWebContents(web_contents); 49 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
48 info_bar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( 50 new AppMetroInfoBarDelegateWin(mode, extension_id))));
49 new AppMetroInfoBarDelegateWin(info_bar_service, mode, extension_id)));
50 51
51 // Use PostTask because we can get here in a COM SendMessage, and 52 // Use PostTask because we can get here in a COM SendMessage, and
52 // ActivateApplication can not be sent nested (returns error 53 // ActivateApplication can not be sent nested (returns error
53 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL). 54 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL).
54 base::MessageLoop::current()->PostTask( 55 base::MessageLoop::current()->PostTask(
55 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); 56 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome)));
56 } 57 }
57 58
58 AppMetroInfoBarDelegateWin::AppMetroInfoBarDelegateWin( 59 AppMetroInfoBarDelegateWin::AppMetroInfoBarDelegateWin(
59 InfoBarService* info_bar_service,
60 Mode mode, 60 Mode mode,
61 const std::string& extension_id) 61 const std::string& extension_id)
62 : ConfirmInfoBarDelegate(info_bar_service), 62 : ConfirmInfoBarDelegate(),
63 mode_(mode), 63 mode_(mode),
64 extension_id_(extension_id) { 64 extension_id_(extension_id) {
65 DCHECK_EQ(mode_ == SHOW_APP_LIST, extension_id_.empty()); 65 DCHECK_EQ(mode_ == SHOW_APP_LIST, extension_id_.empty());
66 } 66 }
67 67
68 AppMetroInfoBarDelegateWin::~AppMetroInfoBarDelegateWin() {} 68 AppMetroInfoBarDelegateWin::~AppMetroInfoBarDelegateWin() {}
69 69
70 int AppMetroInfoBarDelegateWin::GetIconID() const { 70 int AppMetroInfoBarDelegateWin::GetIconID() const {
71 return GetAppListIconResourceId(); 71 return GetAppListIconResourceId();
72 } 72 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 bool AppMetroInfoBarDelegateWin::LinkClicked( 111 bool AppMetroInfoBarDelegateWin::LinkClicked(
112 WindowOpenDisposition disposition) { 112 WindowOpenDisposition disposition) {
113 web_contents()->OpenURL(content::OpenURLParams( 113 web_contents()->OpenURL(content::OpenURLParams(
114 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"), 114 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"),
115 content::Referrer(), 115 content::Referrer(),
116 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 116 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
117 content::PAGE_TRANSITION_LINK, false)); 117 content::PAGE_TRANSITION_LINK, false));
118 return false; 118 return false;
119 } 119 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/apps/app_metro_infobar_delegate_win.h ('k') | chrome/browser/ui/auto_login_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698