diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-22 18:35:59 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-22 18:35:59 +0000 |
commit | bd0690ee89bf3843fdb0ac3a0154fde687595f1a (patch) | |
tree | 0bae7436d2d62cc8e7bb8c02f5ca08833408a9d5 /chrome/browser | |
parent | dadaa61daf304c27c09bab14901cb10877ee8f22 (diff) | |
download | chromium_src-bd0690ee89bf3843fdb0ac3a0154fde687595f1a.zip chromium_src-bd0690ee89bf3843fdb0ac3a0154fde687595f1a.tar.gz chromium_src-bd0690ee89bf3843fdb0ac3a0154fde687595f1a.tar.bz2 |
More misc. cleanup:
* Comment/whitespace/wrapping tweaks
* AutoLoginInfoBarDelegate::GetMessageText() is not called by subclasses, need
not be private
* Reduce indenting via early-returns
* Remove unnecessary #include
BUG=none
TEST=none
R=sky@chromium.org
Review URL: https://codereview.chromium.org/19771018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
9 files changed, 27 insertions, 33 deletions
diff --git a/chrome/browser/ui/auto_login_infobar_delegate.h b/chrome/browser/ui/auto_login_infobar_delegate.h index 96bebb7..6b2366b 100644 --- a/chrome/browser/ui/auto_login_infobar_delegate.h +++ b/chrome/browser/ui/auto_login_infobar_delegate.h @@ -32,16 +32,13 @@ class AutoLoginInfoBarDelegate : public ConfirmInfoBarDelegate, std::string username; }; - // Creates an autologin delegate and adds it to |infobar_service|. + // Creates an autologin infobar delegate and adds it to |infobar_service|. static void Create(InfoBarService* infobar_service, const Params& params); protected: AutoLoginInfoBarDelegate(InfoBarService* owner, const Params& params); virtual ~AutoLoginInfoBarDelegate(); - // ConfirmInfoBarDelegate: - virtual string16 GetMessageText() const OVERRIDE; - private: // Enum values used for UMA histograms. enum Actions { @@ -59,6 +56,7 @@ class AutoLoginInfoBarDelegate : public ConfirmInfoBarDelegate, virtual int GetIconID() const OVERRIDE; virtual Type GetInfoBarType() const OVERRIDE; virtual AutoLoginInfoBarDelegate* AsAutoLoginInfoBarDelegate() OVERRIDE; + virtual string16 GetMessageText() const OVERRIDE; virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; virtual bool Accept() OVERRIDE; virtual bool Cancel() OVERRIDE; diff --git a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm index 4ce489c..5f04437 100644 --- a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm +++ b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm @@ -75,20 +75,19 @@ class KeystonePromotionInfoBarDelegate : public ConfirmInfoBarDelegate { // static void KeystonePromotionInfoBarDelegate::Create() { Browser* browser = chrome::GetLastActiveBrowser(); - if (browser) { - content::WebContents* webContents = - browser->tab_strip_model()->GetActiveWebContents(); - - if (webContents) { - InfoBarService* infobar_service = - InfoBarService::FromWebContents(webContents); - infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( - new KeystonePromotionInfoBarDelegate( - infobar_service, - Profile::FromBrowserContext( - webContents->GetBrowserContext())->GetPrefs()))); - } - } + if (!browser) + return; + content::WebContents* webContents = + browser->tab_strip_model()->GetActiveWebContents(); + if (!webContents) + return; + InfoBarService* infobar_service = + InfoBarService::FromWebContents(webContents); + infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( + new KeystonePromotionInfoBarDelegate( + infobar_service, + Profile::FromBrowserContext( + webContents->GetBrowserContext())->GetPrefs()))); } KeystonePromotionInfoBarDelegate::KeystonePromotionInfoBarDelegate( diff --git a/chrome/browser/ui/collected_cookies_infobar_delegate.cc b/chrome/browser/ui/collected_cookies_infobar_delegate.cc index e335e4d..b60761e 100644 --- a/chrome/browser/ui/collected_cookies_infobar_delegate.cc +++ b/chrome/browser/ui/collected_cookies_infobar_delegate.cc @@ -11,6 +11,7 @@ #include "grit/theme_resources.h" #include "ui/base/l10n/l10n_util.h" + // static void CollectedCookiesInfoBarDelegate::Create(InfoBarService* infobar_service) { infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( diff --git a/chrome/browser/ui/collected_cookies_infobar_delegate.h b/chrome/browser/ui/collected_cookies_infobar_delegate.h index 2c0e1a7..2023026 100644 --- a/chrome/browser/ui/collected_cookies_infobar_delegate.h +++ b/chrome/browser/ui/collected_cookies_infobar_delegate.h @@ -16,7 +16,8 @@ class InfoBarService; // the reload right from the infobar. class CollectedCookiesInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates a collected cookies delegate and adds it to |infobar_service|. + // Creates a collected cookies infobar delegate and adds it to + // |infobar_service|. static void Create(InfoBarService* infobar_service); private: diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc index 32f86d4..a566116 100644 --- a/chrome/browser/ui/content_settings/content_setting_bubble_model.cc +++ b/chrome/browser/ui/content_settings/content_setting_bubble_model.cc @@ -460,7 +460,7 @@ ContentSettingCookiesBubbleModel::ContentSettingCookiesBubbleModel( ContentSettingCookiesBubbleModel::~ContentSettingCookiesBubbleModel() { // On some plattforms e.g. MacOS X it is possible to close a tab while the - // cookies settubgs bubble is open. This resets the web contents to NULL. + // cookies settings bubble is open. This resets the web contents to NULL. if (settings_changed() && web_contents()) { CollectedCookiesInfoBarDelegate::Create( InfoBarService::FromWebContents(web_contents())); diff --git a/chrome/browser/ui/extensions/extension_install_ui_default.cc b/chrome/browser/ui/extensions/extension_install_ui_default.cc index 793ae02..abc00b6 100644 --- a/chrome/browser/ui/extensions/extension_install_ui_default.cc +++ b/chrome/browser/ui/extensions/extension_install_ui_default.cc @@ -82,7 +82,7 @@ void ShowExtensionInstalledBubble(const extensions::Extension* extension, // Helper class to put up an infobar when installation fails. class ErrorInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates an error delegate and adds it to |infobar_service|. + // Creates an error infobar delegate and adds it to |infobar_service|. static void Create(InfoBarService* infobar_service, const extensions::CrxInstallerError& error); @@ -284,7 +284,7 @@ void ExtensionInstallUIDefault::OnInstallFailure( Browser* browser = chrome::FindLastActiveWithProfile(profile_, chrome::GetActiveDesktop()); - if (!browser) // unit tests + if (!browser) // Can be NULL in unittests. return; WebContents* web_contents = browser->tab_strip_model()->GetActiveWebContents(); diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc index 648cba4..1428d1a 100644 --- a/chrome/browser/ui/hung_plugin_tab_helper.cc +++ b/chrome/browser/ui/hung_plugin_tab_helper.cc @@ -131,8 +131,8 @@ void KillPluginOnIOThread(int child_id) { class HungPluginInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates a hung plugin delegate and adds it to |infobar_service|. Returns - // the delegate if it was successfully added. + // Creates a hung plugin infobar delegate and adds it to |infobar_service|. + // Returns the delegate if it was successfully added. static HungPluginInfoBarDelegate* Create(InfoBarService* infobar_service, HungPluginTabHelper* helper, int plugin_child_id, @@ -234,8 +234,7 @@ struct HungPluginTabHelper::PluginState { base::Timer timer; private: - // Delay in seconds before re-showing the hung plugin message. This will be - // increased each time. + // Initial delay in seconds before re-showing the hung plugin message. static const int kInitialReshowDelaySec; // Since the scope of the timer manages our callback, this struct should @@ -329,7 +328,6 @@ void HungPluginTabHelper::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type); - // Note: do not dereference. The InfoBarContainer will delete the object when // it gets this notification, we only remove our tracking info, if we have // any. @@ -338,7 +336,6 @@ void HungPluginTabHelper::Observe( // InfoBars own their delegates. InfoBarDelegate* infobar = content::Details<InfoBarRemovedDetails>(details)->first; - for (PluginStateMap::iterator i = hung_plugins_.begin(); i != hung_plugins_.end(); ++i) { PluginState* state = i->second.get(); @@ -421,9 +418,8 @@ void HungPluginTabHelper::ShowBar(int child_id, PluginState* state) { return; DCHECK(!state->infobar); - state->infobar = - HungPluginInfoBarDelegate::Create(infobar_service, this, child_id, - state->name); + state->infobar = HungPluginInfoBarDelegate::Create(infobar_service, this, + child_id, state->name); } void HungPluginTabHelper::CloseBar(PluginState* state) { diff --git a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h index 5b5f594..90b8fd1 100644 --- a/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h +++ b/chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h @@ -12,7 +12,7 @@ class AlternateNavInfoBarDelegate : public InfoBarDelegate { public: - // Creates an alternate nav delegate and adds it to |infobar_service|. + // Creates an alternate nav infobar delegate and adds it to |infobar_service|. static void Create(InfoBarService* infobar_service, const GURL& alternate_nav_url); diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index a328840..0fd124a 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -25,7 +25,6 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/defaults.h" #include "chrome/browser/google/google_util.h" -#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_info_cache.h" |