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 GURL GetLinkURL() const override; |
89 bool LinkClicked(WindowOpenDisposition disposition) override; | 90 bool LinkClicked(WindowOpenDisposition disposition) override; |
90 | 91 |
91 extensions::CrxInstallError error_; | 92 extensions::CrxInstallError error_; |
92 | 93 |
93 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate); | 94 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate); |
94 }; | 95 }; |
95 | 96 |
96 // static | 97 // static |
97 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service, | 98 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service, |
98 const extensions::CrxInstallError& error) { | 99 const extensions::CrxInstallError& error) { |
(...skipping 16 matching lines...) Expand all Loading... |
115 int ErrorInfoBarDelegate::GetButtons() const { | 116 int ErrorInfoBarDelegate::GetButtons() const { |
116 return BUTTON_OK; | 117 return BUTTON_OK; |
117 } | 118 } |
118 | 119 |
119 base::string16 ErrorInfoBarDelegate::GetLinkText() const { | 120 base::string16 ErrorInfoBarDelegate::GetLinkText() const { |
120 return (error_.type() == extensions::CrxInstallError::ERROR_OFF_STORE) | 121 return (error_.type() == extensions::CrxInstallError::ERROR_OFF_STORE) |
121 ? l10n_util::GetStringUTF16(IDS_LEARN_MORE) | 122 ? l10n_util::GetStringUTF16(IDS_LEARN_MORE) |
122 : base::string16(); | 123 : base::string16(); |
123 } | 124 } |
124 | 125 |
| 126 GURL ErrorInfoBarDelegate::GetLinkURL() const { |
| 127 return GURL("https://support.google.com/chrome_webstore/?p=crx_warning"); |
| 128 } |
| 129 |
125 bool ErrorInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { | 130 bool ErrorInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { |
126 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( | 131 InfoBarService::WebContentsFromInfoBar(infobar())->OpenURL( |
127 content::OpenURLParams( | 132 content::OpenURLParams( |
128 GURL("https://support.google.com/chrome_webstore/?p=crx_warning"), | 133 GetLinkURL(), |
129 content::Referrer(), | 134 content::Referrer(), |
130 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 135 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
131 ui::PAGE_TRANSITION_LINK, false)); | 136 ui::PAGE_TRANSITION_LINK, false)); |
132 return false; | 137 return false; |
133 } | 138 } |
134 | 139 |
135 } // namespace | 140 } // namespace |
136 | 141 |
137 ExtensionInstallUIDefault::ExtensionInstallUIDefault( | 142 ExtensionInstallUIDefault::ExtensionInstallUIDefault( |
138 content::BrowserContext* context) | 143 content::BrowserContext* context) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { | 260 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { |
256 Browser* browser = | 261 Browser* browser = |
257 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); | 262 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); |
258 if (browser) { | 263 if (browser) { |
259 content::WebContents* contents = | 264 content::WebContents* contents = |
260 browser->tab_strip_model()->GetActiveWebContents(); | 265 browser->tab_strip_model()->GetActiveWebContents(); |
261 return contents->GetTopLevelNativeWindow(); | 266 return contents->GetTopLevelNativeWindow(); |
262 } | 267 } |
263 return NULL; | 268 return NULL; |
264 } | 269 } |
OLD | NEW |