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

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

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
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"
14 #include "chrome/browser/lifetime/application_lifetime.h" 12 #include "chrome/browser/lifetime/application_lifetime.h"
15 #include "chrome/browser/metro_utils/metro_chrome_win.h" 13 #include "chrome/browser/metro_utils/metro_chrome_win.h"
16 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/app_list/app_list_icon_win.h" 15 #include "chrome/browser/ui/app_list/app_list_icon_win.h"
18 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h" 17 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/host_desktop.h" 18 #include "chrome/browser/ui/host_desktop.h"
21 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" 19 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
22 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
23 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
(...skipping 14 matching lines...) Expand all
38 // Chrome should never get here via the Ash desktop, so only look for browsers 36 // Chrome should never get here via the Ash desktop, so only look for browsers
39 // on the native desktop. 37 // on the native desktop.
40 chrome::ScopedTabbedBrowserDisplayer displayer( 38 chrome::ScopedTabbedBrowserDisplayer displayer(
41 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); 39 profile, chrome::HOST_DESKTOP_TYPE_NATIVE);
42 40
43 // Create a new tab at about:blank, and add the infobar. 41 // Create a new tab at about:blank, and add the infobar.
44 content::OpenURLParams params(GURL(content::kAboutBlankURL), 42 content::OpenURLParams params(GURL(content::kAboutBlankURL),
45 content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, 43 content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK,
46 false); 44 false);
47 content::WebContents* web_contents = displayer.browser()->OpenURL(params); 45 content::WebContents* web_contents = displayer.browser()->OpenURL(params);
48 InfoBarService::FromWebContents(web_contents)->AddInfoBar( 46 InfoBarService* info_bar_service =
49 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 47 InfoBarService::FromWebContents(web_contents);
50 new AppMetroInfoBarDelegateWin(mode, extension_id)))); 48 info_bar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
49 new AppMetroInfoBarDelegateWin(info_bar_service, mode, extension_id)));
51 50
52 // 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
53 // ActivateApplication can not be sent nested (returns error 52 // ActivateApplication can not be sent nested (returns error
54 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL). 53 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL).
55 base::MessageLoop::current()->PostTask( 54 base::MessageLoop::current()->PostTask(
56 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); 55 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome)));
57 } 56 }
58 57
59 AppMetroInfoBarDelegateWin::AppMetroInfoBarDelegateWin( 58 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(), 62 : ConfirmInfoBarDelegate(info_bar_service),
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

Powered by Google App Engine
This is Rietveld 408576698