OLD | NEW |
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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 chrome::ScopedTabbedBrowserDisplayer displayer( | 40 chrome::ScopedTabbedBrowserDisplayer displayer( |
41 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); | 41 profile, chrome::HOST_DESKTOP_TYPE_NATIVE); |
42 | 42 |
43 // Create a new tab at about:blank, and add the infobar. | 43 // Create a new tab at about:blank, and add the infobar. |
44 content::OpenURLParams params(GURL(content::kAboutBlankURL), | 44 content::OpenURLParams params(GURL(content::kAboutBlankURL), |
45 content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, | 45 content::Referrer(), NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, |
46 false); | 46 false); |
47 content::WebContents* web_contents = displayer.browser()->OpenURL(params); | 47 content::WebContents* web_contents = displayer.browser()->OpenURL(params); |
48 InfoBarService::FromWebContents(web_contents)->AddInfoBar( | 48 InfoBarService::FromWebContents(web_contents)->AddInfoBar( |
49 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 49 ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
50 new AppMetroInfoBarDelegateWin(mode, extension_id)))); | 50 new AppMetroInfoBarDelegateWin(web_contents, mode, extension_id)))); |
51 | 51 |
52 // 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 |
53 // ActivateApplication can not be sent nested (returns error | 53 // ActivateApplication can not be sent nested (returns error |
54 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL). | 54 // RPC_E_CANTCALLOUT_ININPUTSYNCCALL). |
55 base::MessageLoop::current()->PostTask( | 55 base::MessageLoop::current()->PostTask( |
56 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); | 56 FROM_HERE, base::Bind(base::IgnoreResult(chrome::ActivateMetroChrome))); |
57 } | 57 } |
58 | 58 |
59 AppMetroInfoBarDelegateWin::AppMetroInfoBarDelegateWin( | 59 AppMetroInfoBarDelegateWin::AppMetroInfoBarDelegateWin( |
| 60 content::WebContents* web_contents, |
60 Mode mode, | 61 Mode mode, |
61 const std::string& extension_id) | 62 const std::string& extension_id) |
62 : ConfirmInfoBarDelegate(), | 63 : ContentConfirmInfoBarDelegate(web_contents), |
63 mode_(mode), | 64 mode_(mode), |
64 extension_id_(extension_id) { | 65 extension_id_(extension_id) { |
65 DCHECK_EQ(mode_ == SHOW_APP_LIST, extension_id_.empty()); | 66 DCHECK_EQ(mode_ == SHOW_APP_LIST, extension_id_.empty()); |
66 } | 67 } |
67 | 68 |
68 AppMetroInfoBarDelegateWin::~AppMetroInfoBarDelegateWin() {} | 69 AppMetroInfoBarDelegateWin::~AppMetroInfoBarDelegateWin() {} |
69 | 70 |
70 int AppMetroInfoBarDelegateWin::GetIconID() const { | 71 int AppMetroInfoBarDelegateWin::GetIconID() const { |
71 return GetAppListIconResourceId(); | 72 return GetAppListIconResourceId(); |
72 } | 73 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 111 |
111 bool AppMetroInfoBarDelegateWin::LinkClicked( | 112 bool AppMetroInfoBarDelegateWin::LinkClicked( |
112 WindowOpenDisposition disposition) { | 113 WindowOpenDisposition disposition) { |
113 web_contents()->OpenURL(content::OpenURLParams( | 114 web_contents()->OpenURL(content::OpenURLParams( |
114 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 115 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
115 content::Referrer(), | 116 content::Referrer(), |
116 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 117 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
117 content::PAGE_TRANSITION_LINK, false)); | 118 content::PAGE_TRANSITION_LINK, false)); |
118 return false; | 119 return false; |
119 } | 120 } |
OLD | NEW |