OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extension_install_ui_default.h" | 5 #include "chrome/browser/ui/extensions/extension_install_ui_default.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" | 10 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 const extensions::CrxInstallError& error); | 79 const extensions::CrxInstallError& error); |
80 | 80 |
81 private: | 81 private: |
82 explicit ErrorInfoBarDelegate(const extensions::CrxInstallError& error); | 82 explicit ErrorInfoBarDelegate(const extensions::CrxInstallError& error); |
83 ~ErrorInfoBarDelegate() override; | 83 ~ErrorInfoBarDelegate() override; |
84 | 84 |
85 // ConfirmInfoBarDelegate: | 85 // ConfirmInfoBarDelegate: |
86 base::string16 GetMessageText() const override; | 86 base::string16 GetMessageText() const override; |
87 int GetButtons() const override; | 87 int GetButtons() const override; |
88 base::string16 GetLinkText() const override; | 88 base::string16 GetLinkText() const override; |
89 bool LinkClicked(WindowOpenDisposition disposition) override; | 89 GURL GetLinkURL() const override; |
90 | 90 |
91 extensions::CrxInstallError error_; | 91 extensions::CrxInstallError error_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate); | 93 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate); |
94 }; | 94 }; |
95 | 95 |
96 // static | 96 // static |
97 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service, | 97 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service, |
98 const extensions::CrxInstallError& error) { | 98 const extensions::CrxInstallError& error) { |
99 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( | 99 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( |
(...skipping 15 matching lines...) Expand all Loading... |
115 int ErrorInfoBarDelegate::GetButtons() const { | 115 int ErrorInfoBarDelegate::GetButtons() const { |
116 return BUTTON_OK; | 116 return BUTTON_OK; |
117 } | 117 } |
118 | 118 |
119 base::string16 ErrorInfoBarDelegate::GetLinkText() const { | 119 base::string16 ErrorInfoBarDelegate::GetLinkText() const { |
120 return (error_.type() == extensions::CrxInstallError::ERROR_OFF_STORE) | 120 return (error_.type() == extensions::CrxInstallError::ERROR_OFF_STORE) |
121 ? l10n_util::GetStringUTF16(IDS_LEARN_MORE) | 121 ? l10n_util::GetStringUTF16(IDS_LEARN_MORE) |
122 : base::string16(); | 122 : base::string16(); |
123 } | 123 } |
124 | 124 |
125 bool ErrorInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 125 GURL ErrorInfoBarDelegate::GetLinkURL() const { |
126 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 126 return GURL("https://support.google.com/chrome_webstore/?p=crx_warning"); |
127 content::OpenURLParams( | |
128 GURL("https://support.google.com/chrome_webstore/?p=crx_warning"), | |
129 content::Referrer(), | |
130 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | |
131 ui::PAGE_TRANSITION_LINK, false)); | |
132 return false; | |
133 } | 127 } |
134 | 128 |
135 } // namespace | 129 } // namespace |
136 | 130 |
137 ExtensionInstallUIDefault::ExtensionInstallUIDefault( | 131 ExtensionInstallUIDefault::ExtensionInstallUIDefault( |
138 content::BrowserContext* context) | 132 content::BrowserContext* context) |
139 : profile_(Profile::FromBrowserContext(context)), | 133 : profile_(Profile::FromBrowserContext(context)), |
140 skip_post_install_ui_(false), | 134 skip_post_install_ui_(false), |
141 previous_using_system_theme_(false), | 135 previous_using_system_theme_(false), |
142 use_app_installed_bubble_(false) { | 136 use_app_installed_bubble_(false) { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { | 249 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { |
256 Browser* browser = | 250 Browser* browser = |
257 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); | 251 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); |
258 if (browser) { | 252 if (browser) { |
259 content::WebContents* contents = | 253 content::WebContents* contents = |
260 browser->tab_strip_model()->GetActiveWebContents(); | 254 browser->tab_strip_model()->GetActiveWebContents(); |
261 return contents->GetTopLevelNativeWindow(); | 255 return contents->GetTopLevelNativeWindow(); |
262 } | 256 } |
263 return NULL; | 257 return NULL; |
264 } | 258 } |
OLD | NEW |