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/extensions/app_metro_infobar_delegate_win.h" | 5 #include "chrome/browser/ui/extensions/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.h" | 9 #include "base/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 string16 AppMetroInfoBarDelegateWin::GetButtonLabel( | 87 string16 AppMetroInfoBarDelegateWin::GetButtonLabel( |
88 InfoBarButton button) const { | 88 InfoBarButton button) const { |
89 return l10n_util::GetStringUTF16(button == BUTTON_CANCEL ? | 89 return l10n_util::GetStringUTF16(button == BUTTON_CANCEL ? |
90 IDS_WIN8_INFOBAR_DESKTOP_RESTART_TO_LAUNCH_APPS_NO_BUTTON : | 90 IDS_WIN8_INFOBAR_DESKTOP_RESTART_TO_LAUNCH_APPS_NO_BUTTON : |
91 IDS_WIN8_INFOBAR_DESKTOP_RESTART_TO_LAUNCH_APPS_YES_BUTTON); | 91 IDS_WIN8_INFOBAR_DESKTOP_RESTART_TO_LAUNCH_APPS_YES_BUTTON); |
92 } | 92 } |
93 | 93 |
94 bool AppMetroInfoBarDelegateWin::Accept() { | 94 bool AppMetroInfoBarDelegateWin::Accept() { |
95 PrefService* prefs = g_browser_process->local_state(); | 95 PrefService* prefs = g_browser_process->local_state(); |
96 content::WebContents* web_contents = owner()->GetWebContents(); | 96 content::WebContents* web_contents = owner()->web_contents(); |
97 if (mode_ == SHOW_APP_LIST) { | 97 if (mode_ == SHOW_APP_LIST) { |
98 prefs->SetBoolean(prefs::kRestartWithAppList, true); | 98 prefs->SetBoolean(prefs::kRestartWithAppList, true); |
99 } else { | 99 } else { |
100 apps::SetAppLaunchForMetroRestart( | 100 apps::SetAppLaunchForMetroRestart( |
101 Profile::FromBrowserContext(web_contents->GetBrowserContext()), | 101 Profile::FromBrowserContext(web_contents->GetBrowserContext()), |
102 extension_id_); | 102 extension_id_); |
103 } | 103 } |
104 | 104 |
105 web_contents->Close(); // Note: deletes |this|. | 105 web_contents->Close(); // Note: deletes |this|. |
106 chrome::AttemptRestartWithModeSwitch(); | 106 chrome::AttemptRestartWithModeSwitch(); |
107 return false; | 107 return false; |
108 } | 108 } |
109 | 109 |
110 bool AppMetroInfoBarDelegateWin::Cancel() { | 110 bool AppMetroInfoBarDelegateWin::Cancel() { |
111 owner()->GetWebContents()->Close(); | 111 owner()->web_contents()->Close(); |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 string16 AppMetroInfoBarDelegateWin::GetLinkText() const { | 115 string16 AppMetroInfoBarDelegateWin::GetLinkText() const { |
116 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 116 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
117 } | 117 } |
118 | 118 |
119 bool AppMetroInfoBarDelegateWin::LinkClicked( | 119 bool AppMetroInfoBarDelegateWin::LinkClicked( |
120 WindowOpenDisposition disposition) { | 120 WindowOpenDisposition disposition) { |
121 content::OpenURLParams params( | 121 content::OpenURLParams params( |
122 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"), | 122 GURL("https://support.google.com/chrome/?p=ib_redirect_to_desktop"), |
123 content::Referrer(), | 123 content::Referrer(), |
124 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 124 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
125 content::PAGE_TRANSITION_LINK, false); | 125 content::PAGE_TRANSITION_LINK, false); |
126 owner()->GetWebContents()->OpenURL(params); | 126 owner()->web_contents()->OpenURL(params); |
127 return false; | 127 return false; |
128 } | 128 } |
129 | 129 |
130 } // namespace chrome | 130 } // namespace chrome |
OLD | NEW |