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

Side by Side Diff: chrome/browser/ui/extensions/extension_install_ui_default.cc

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit again Created 4 years, 11 months 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
OLDNEW
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/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Creates an error infobar and delegate and adds the infobar to 79 // Creates an error infobar and delegate and adds the infobar to
80 // |infobar_service|. 80 // |infobar_service|.
81 static void Create(InfoBarService* infobar_service, 81 static void Create(InfoBarService* infobar_service,
82 const extensions::CrxInstallError& error); 82 const extensions::CrxInstallError& error);
83 83
84 private: 84 private:
85 explicit ErrorInfoBarDelegate(const extensions::CrxInstallError& error); 85 explicit ErrorInfoBarDelegate(const extensions::CrxInstallError& error);
86 ~ErrorInfoBarDelegate() override; 86 ~ErrorInfoBarDelegate() override;
87 87
88 // ConfirmInfoBarDelegate: 88 // ConfirmInfoBarDelegate:
89 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
89 base::string16 GetMessageText() const override; 90 base::string16 GetMessageText() const override;
90 int GetButtons() const override; 91 int GetButtons() const override;
91 base::string16 GetLinkText() const override; 92 base::string16 GetLinkText() const override;
92 GURL GetLinkURL() const override; 93 GURL GetLinkURL() const override;
93 94
94 extensions::CrxInstallError error_; 95 extensions::CrxInstallError error_;
95 96
96 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate); 97 DISALLOW_COPY_AND_ASSIGN(ErrorInfoBarDelegate);
97 }; 98 };
98 99
99 // static 100 // static
100 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service, 101 void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service,
101 const extensions::CrxInstallError& error) { 102 const extensions::CrxInstallError& error) {
102 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( 103 infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
103 scoped_ptr<ConfirmInfoBarDelegate>(new ErrorInfoBarDelegate(error)))); 104 scoped_ptr<ConfirmInfoBarDelegate>(new ErrorInfoBarDelegate(error))));
104 } 105 }
105 106
106 ErrorInfoBarDelegate::ErrorInfoBarDelegate( 107 ErrorInfoBarDelegate::ErrorInfoBarDelegate(
107 const extensions::CrxInstallError& error) 108 const extensions::CrxInstallError& error)
108 : ConfirmInfoBarDelegate(), error_(error) { 109 : ConfirmInfoBarDelegate(), error_(error) {
109 } 110 }
110 111
111 ErrorInfoBarDelegate::~ErrorInfoBarDelegate() { 112 ErrorInfoBarDelegate::~ErrorInfoBarDelegate() {
112 } 113 }
113 114
115 infobars::InfoBarDelegate::InfoBarIdentifier
116 ErrorInfoBarDelegate::GetIdentifier() const {
117 return INSTALLATION_ERROR_INFOBAR_DELEGATE;
118 }
119
114 base::string16 ErrorInfoBarDelegate::GetMessageText() const { 120 base::string16 ErrorInfoBarDelegate::GetMessageText() const {
115 return error_.message(); 121 return error_.message();
116 } 122 }
117 123
118 int ErrorInfoBarDelegate::GetButtons() const { 124 int ErrorInfoBarDelegate::GetButtons() const {
119 return BUTTON_OK; 125 return BUTTON_OK;
120 } 126 }
121 127
122 base::string16 ErrorInfoBarDelegate::GetLinkText() const { 128 base::string16 ErrorInfoBarDelegate::GetLinkText() const {
123 return (error_.type() == extensions::CrxInstallError::ERROR_OFF_STORE) 129 return (error_.type() == extensions::CrxInstallError::ERROR_OFF_STORE)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() { 258 gfx::NativeWindow ExtensionInstallUIDefault::GetDefaultInstallDialogParent() {
253 Browser* browser = 259 Browser* browser =
254 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); 260 chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop());
255 if (browser) { 261 if (browser) {
256 content::WebContents* contents = 262 content::WebContents* contents =
257 browser->tab_strip_model()->GetActiveWebContents(); 263 browser->tab_strip_model()->GetActiveWebContents();
258 return contents->GetTopLevelNativeWindow(); 264 return contents->GetTopLevelNativeWindow();
259 } 265 }
260 return NULL; 266 return NULL;
261 } 267 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/collected_cookies_infobar_delegate.cc ('k') | chrome/browser/ui/hung_plugin_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698