diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 20:20:42 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-19 20:20:42 +0000 |
commit | 4ee3c9178033e55af43819f387a92db1d250730d (patch) | |
tree | 6204ac8d045451693d3443ac3e87b267c8211936 | |
parent | 162b554a5b6c41e145b071b63a16447177f900c6 (diff) | |
download | chromium_src-4ee3c9178033e55af43819f387a92db1d250730d.zip chromium_src-4ee3c9178033e55af43819f387a92db1d250730d.tar.gz chromium_src-4ee3c9178033e55af43819f387a92db1d250730d.tar.bz2 |
More misc. cleanup:
* Minor naming/spacing/comment improvements
* Style guide: Constructors/destructors, then other functions (incl. statics)
* Multi-line conditional bodies need {}
BUG=none
TEST=none
R=sky@chromium.org
Review URL: https://codereview.chromium.org/19771012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212636 0039d316-1c4b-4281-b951-d872f2087c98
13 files changed, 42 insertions, 39 deletions
diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc index a85b677..804fa24 100644 --- a/chrome/browser/chrome_quota_permission_context.cc +++ b/chrome/browser/chrome_quota_permission_context.cc @@ -54,7 +54,6 @@ class RequestQuotaInfoBarDelegate : public ConfirmInfoBarDelegate { // ConfirmInfoBarDelegate: virtual bool ShouldExpireInternal( const content::LoadCommittedDetails& details) const OVERRIDE; - virtual string16 GetMessageText() const OVERRIDE; virtual bool Accept() OVERRIDE; virtual bool Cancel() OVERRIDE; diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h index 3e73c14..90b7eae 100644 --- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h +++ b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h @@ -16,9 +16,10 @@ class ProtocolHandlerRegistry; // card information gathered from a form submission. class RegisterProtocolHandlerInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates a new RPH delegate. Searches |infobar_service| for an existing - // delegate for the same |handler|; replaces it with the new delegate if - // found, otherwise adds the new infobar to |infobar_service|. + // Creates a new register protocol handler infobar delegate. Searches + // |infobar_service| for an existing delegate for the same |handler|; replaces + // it with the new delegate if found, otherwise adds the new infobar to + // |infobar_service|. static void Create(InfoBarService* infobar_service, ProtocolHandlerRegistry* registry, const ProtocolHandler& handler); diff --git a/chrome/browser/download/download_request_infobar_delegate.h b/chrome/browser/download/download_request_infobar_delegate.h index 815e3ca..410f91f 100644 --- a/chrome/browser/download/download_request_infobar_delegate.h +++ b/chrome/browser/download/download_request_infobar_delegate.h @@ -23,15 +23,13 @@ class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host)> FakeCreateCallback; + virtual ~DownloadRequestInfoBarDelegate(); + // Creates a download request delegate and adds it to |infobar_service|. static void Create( InfoBarService* infobar_service, base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host); - static void SetCallbackForTesting(FakeCreateCallback* callback); - - virtual ~DownloadRequestInfoBarDelegate(); - #if defined(UNIT_TEST) static scoped_ptr<DownloadRequestInfoBarDelegate> Create( base::WeakPtr<DownloadRequestLimiter::TabDownloadState> host) { @@ -40,6 +38,8 @@ class DownloadRequestInfoBarDelegate : public ConfirmInfoBarDelegate { } #endif + static void SetCallbackForTesting(FakeCreateCallback* callback); + private: static FakeCreateCallback* callback_; diff --git a/chrome/browser/media/media_stream_infobar_delegate.cc b/chrome/browser/media/media_stream_infobar_delegate.cc index 3fc8661..5e2aa87 100644 --- a/chrome/browser/media/media_stream_infobar_delegate.cc +++ b/chrome/browser/media/media_stream_infobar_delegate.cc @@ -65,6 +65,7 @@ MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate( DCHECK(controller_.get()); DCHECK(controller_->has_audio() || controller_->has_video()); } + void MediaStreamInfoBarDelegate::InfoBarDismissed() { // Deny the request if the infobar was closed with the 'x' button, since // we don't want WebRTC to be waiting for an answer that will never come. diff --git a/chrome/browser/media/media_stream_infobar_delegate.h b/chrome/browser/media/media_stream_infobar_delegate.h index 02992e7..b2aaeeb 100644 --- a/chrome/browser/media/media_stream_infobar_delegate.h +++ b/chrome/browser/media/media_stream_infobar_delegate.h @@ -22,9 +22,9 @@ class MediaStreamInfoBarDelegate : public ConfirmInfoBarDelegate { virtual ~MediaStreamInfoBarDelegate(); // Handles a permission request (in |request|) for |web_contents|. If this - // involves prompting the user, creates a media stream delegate, then checks - // for an existing infobar for |web_contents| and replaces it if found, or - // just adds the new infobar otherwise. Returns whether an infobar was + // involves prompting the user, creates a media stream infobar delegate, then + // checks for an existing infobar for |web_contents| and replaces it if found, + // or just adds the new infobar otherwise. Returns whether an infobar was // created. static bool Create(content::WebContents* web_contents, const content::MediaStreamRequest& request, diff --git a/chrome/browser/nacl_host/nacl_infobar_delegate.cc b/chrome/browser/nacl_host/nacl_infobar_delegate.cc index b9e08b8..fecad03 100644 --- a/chrome/browser/nacl_host/nacl_infobar_delegate.cc +++ b/chrome/browser/nacl_host/nacl_infobar_delegate.cc @@ -24,9 +24,10 @@ void NaClInfoBarDelegate::Create(int render_process_id, int render_view_id) { return; InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); - if (infobar_service) + if (infobar_service) { infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( new NaClInfoBarDelegate(infobar_service))); + } } NaClInfoBarDelegate::NaClInfoBarDelegate(InfoBarService* infobar_service) diff --git a/chrome/browser/nacl_host/nacl_infobar_delegate.h b/chrome/browser/nacl_host/nacl_infobar_delegate.h index c3da4d4..2b3b4e9 100644 --- a/chrome/browser/nacl_host/nacl_infobar_delegate.h +++ b/chrome/browser/nacl_host/nacl_infobar_delegate.h @@ -9,8 +9,8 @@ class NaClInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates a NaCl delegate and adds it to the infobar service corresponding to - // the given render process and view IDs. + // Creates a NaCl infobar delegate and adds it to the infobar service + // corresponding to the given render process and view IDs. static void Create(int render_process_id, int render_view_id); private: diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index e81a2b1..b75db4f 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -64,7 +64,7 @@ using WebKit::WebSecurityOrigin; // permissions. class NotificationPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates a notification permission delegate and adds it to + // Creates a notification permission infobar delegate and adds it to // |infobar_service|. static void Create(InfoBarService* infobar_service, DesktopNotificationService* notification_service, diff --git a/chrome/browser/password_manager/password_manager_delegate_impl.cc b/chrome/browser/password_manager/password_manager_delegate_impl.cc index edf7a23..95ce6b8 100644 --- a/chrome/browser/password_manager/password_manager_delegate_impl.cc +++ b/chrome/browser/password_manager/password_manager_delegate_impl.cc @@ -40,7 +40,8 @@ class SavePasswordInfoBarDelegate : public ConfirmInfoBarDelegate { public: // If we won't be showing the one-click signin infobar, creates a save - // password delegate and adds it to the InfoBarService for |web_contents|. + // password infobar delegate and adds it to the InfoBarService for + // |web_contents|. static void Create(content::WebContents* web_contents, PasswordFormManager* form_to_save); diff --git a/chrome/browser/pepper_broker_infobar_delegate.h b/chrome/browser/pepper_broker_infobar_delegate.h index 33574d1..220297c 100644 --- a/chrome/browser/pepper_broker_infobar_delegate.h +++ b/chrome/browser/pepper_broker_infobar_delegate.h @@ -25,7 +25,7 @@ class PepperBrokerInfoBarDelegate : public ConfirmInfoBarDelegate { public: // Determines whether the broker setting is allow, deny, or ask. In the first // two cases, runs the callback directly. In the third, creates a pepper - // broker delegate and adds it to the InfoBarService associated with + // broker infobar delegate and adds it to the InfoBarService associated with // |web_contents|. static void Create(content::WebContents* web_contents, const GURL& url, diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index 9eb3dea..33e5b12 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -1635,16 +1635,16 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_TranslateEnabled) { // Verify that the translate infobar showed up. ASSERT_EQ(1u, infobar_service->infobar_count()); - InfoBarDelegate* infobar_delegate = infobar_service->infobar_at(0); - TranslateInfoBarDelegate* delegate = - infobar_delegate->AsTranslateInfoBarDelegate(); - ASSERT_TRUE(delegate); + InfoBarDelegate* infobar = infobar_service->infobar_at(0); + TranslateInfoBarDelegate* translate_infobar_delegate = + infobar->AsTranslateInfoBarDelegate(); + ASSERT_TRUE(translate_infobar_delegate); EXPECT_EQ(TranslateInfoBarDelegate::BEFORE_TRANSLATE, - delegate->infobar_type()); - EXPECT_EQ("fr", delegate->original_language_code()); + translate_infobar_delegate->infobar_type()); + EXPECT_EQ("fr", translate_infobar_delegate->original_language_code()); // Now force disable translate. - infobar_service->RemoveInfoBar(infobar_delegate); + infobar_service->RemoveInfoBar(infobar); EXPECT_EQ(0u, infobar_service->infobar_count()); policies.Set(key::kTranslateEnabled, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false), NULL); diff --git a/chrome/browser/ssl/ssl_tab_helper.cc b/chrome/browser/ssl/ssl_tab_helper.cc index 802687e..9cb9fde 100644 --- a/chrome/browser/ssl/ssl_tab_helper.cc +++ b/chrome/browser/ssl/ssl_tab_helper.cc @@ -42,9 +42,9 @@ namespace { class SSLCertResultInfoBarDelegate : public ConfirmInfoBarDelegate { public: - // Creates an SSL cert result delegate. If |previous_infobar| is + // Creates an SSL cert result infobar delegate. If |previous_infobar| is // NULL, adds the infobar to |infobar_service|; otherwise, replaces - // |previous_infobar|. Returns the new delegate if it was successfully added. + // |previous_infobar|. Returns the new infobar if it was successfully added. // |cert| is valid iff cert addition was successful. static InfoBarDelegate* Create(InfoBarService* infobar_service, InfoBarDelegate* previous_infobar, @@ -137,7 +137,7 @@ class SSLTabHelper::SSLAddCertData explicit SSLAddCertData(InfoBarService* infobar_service); virtual ~SSLAddCertData(); - // Displays an infobar, replacing |infobar_delegate_| if it exists. + // Displays an infobar, replacing |infobar_| if it exists. void ShowInfoBar(const string16& message, net::X509Certificate* cert); private: @@ -147,7 +147,7 @@ class SSLTabHelper::SSLAddCertData const content::NotificationDetails& details) OVERRIDE; InfoBarService* infobar_service_; - InfoBarDelegate* infobar_delegate_; + InfoBarDelegate* infobar_; content::NotificationRegistrar registrar_; DISALLOW_COPY_AND_ASSIGN(SSLAddCertData); @@ -155,7 +155,7 @@ class SSLTabHelper::SSLAddCertData SSLTabHelper::SSLAddCertData::SSLAddCertData(InfoBarService* infobar_service) : infobar_service_(infobar_service), - infobar_delegate_(NULL) { + infobar_(NULL) { content::Source<InfoBarService> source(infobar_service_); registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, source); @@ -168,8 +168,8 @@ SSLTabHelper::SSLAddCertData::~SSLAddCertData() { void SSLTabHelper::SSLAddCertData::ShowInfoBar(const string16& message, net::X509Certificate* cert) { - infobar_delegate_ = SSLCertResultInfoBarDelegate::Create( - infobar_service_, infobar_delegate_, message, cert); + infobar_ = SSLCertResultInfoBarDelegate::Create(infobar_service_, infobar_, + message, cert); } void SSLTabHelper::SSLAddCertData::Observe( @@ -178,11 +178,11 @@ void SSLTabHelper::SSLAddCertData::Observe( const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED || type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REPLACED); - if (infobar_delegate_ == + if (infobar_ == ((type == chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED) ? content::Details<InfoBarRemovedDetails>(details)->first : content::Details<InfoBarReplacedDetails>(details)->first)) - infobar_delegate_ = NULL; + infobar_ = NULL; } diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc index 1baa0fc..1953ffe 100644 --- a/chrome/test/ppapi/ppapi_test.cc +++ b/chrome/test/ppapi/ppapi_test.cc @@ -88,17 +88,17 @@ void PPAPITestBase::InfoBarObserver::Observe( const content::NotificationSource& source, const content::NotificationDetails& details) { ASSERT_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, type); - InfoBarDelegate* info_bar_delegate = + InfoBarDelegate* infobar = content::Details<InfoBarAddedDetails>(details).ptr(); - ConfirmInfoBarDelegate* confirm_info_bar_delegate = - info_bar_delegate->AsConfirmInfoBarDelegate(); - ASSERT_TRUE(confirm_info_bar_delegate); + ConfirmInfoBarDelegate* confirm_infobar_delegate = + infobar->AsConfirmInfoBarDelegate(); + ASSERT_TRUE(confirm_infobar_delegate); ASSERT_FALSE(expected_infobars_.empty()) << "Unexpected infobar"; if (expected_infobars_.front()) - confirm_info_bar_delegate->Accept(); + confirm_infobar_delegate->Accept(); else - confirm_info_bar_delegate->Cancel(); + confirm_infobar_delegate->Cancel(); expected_infobars_.pop_front(); // TODO(bauerb): We should close the infobar. |