summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 04:20:40 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-08 04:20:40 +0000
commitec8f51164d477d8d83726fe61c68977d17b03149 (patch)
treede1ea01984caab5a5841c8a7c1593805157ce60d /chrome/browser/extensions
parentef47ded033e48098e83bb94e63b6e44ca6b511b4 (diff)
downloadchromium_src-ec8f51164d477d8d83726fe61c68977d17b03149.zip
chromium_src-ec8f51164d477d8d83726fe61c68977d17b03149.tar.gz
chromium_src-ec8f51164d477d8d83726fe61c68977d17b03149.tar.bz2
Cleanup:
* Change int to size_t in a few APIs. * Rename infobar_delegate_count() to infobar_count() in preparation for TabContents owning InfoBars rather than InfoBarDelegates. * Move some code from PluginInstallerInfoBarDelegate to PluginObserver since it's more related to who's instantiating the infobar(delegate)s. * Unify InfoBarDelegate behavior by making no delegates auto-add themselves to tabs (callers now all do this explicitly). * Eliminate unused member TabContentsSSLHelper::SSLAddCertData::handler_. * De-inline a couple classes. * Make more functions private. * Add some consts. * Change DCHECK() to DCHECK_EQ() where possible. * Rename the delegates in plugin_observer.cc to have "Delegate" in the names. * Remove unnecessary qualifiers. * Simplify. * Misc. style issues, naming issues, etc. BUG=none TEST=none Review URL: http://codereview.chromium.org/6250172 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74086 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions')
-rw-r--r--chrome/browser/extensions/crashed_extension_infobar.cc2
-rw-r--r--chrome/browser/extensions/crashed_extension_infobar.h7
-rw-r--r--chrome/browser/extensions/extension_crash_recovery_browsertest.cc44
-rw-r--r--chrome/browser/extensions/extension_infobar_delegate.h3
-rw-r--r--chrome/browser/extensions/extension_install_ui.cc2
-rw-r--r--chrome/browser/extensions/extension_install_ui_browsertest.cc4
-rw-r--r--chrome/browser/extensions/theme_installed_infobar_delegate.cc2
-rw-r--r--chrome/browser/extensions/theme_installed_infobar_delegate.h2
8 files changed, 33 insertions, 33 deletions
diff --git a/chrome/browser/extensions/crashed_extension_infobar.cc b/chrome/browser/extensions/crashed_extension_infobar.cc
index 3e88d28..19db635 100644
--- a/chrome/browser/extensions/crashed_extension_infobar.cc
+++ b/chrome/browser/extensions/crashed_extension_infobar.cc
@@ -50,7 +50,7 @@ CrashedExtensionInfoBarDelegate*
string16 CrashedExtensionInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringFUTF16(IDS_EXTENSION_CRASHED_INFOBAR_MESSAGE,
- UTF8ToUTF16(extension_name_));
+ UTF8ToUTF16(extension_name_));
}
int CrashedExtensionInfoBarDelegate::GetButtons() const {
diff --git a/chrome/browser/extensions/crashed_extension_infobar.h b/chrome/browser/extensions/crashed_extension_infobar.h
index 892a04d..d4d08a7 100644
--- a/chrome/browser/extensions/crashed_extension_infobar.h
+++ b/chrome/browser/extensions/crashed_extension_infobar.h
@@ -29,9 +29,9 @@ class CrashedExtensionInfoBarDelegate : public ConfirmInfoBarDelegate {
const std::string extension_id() { return extension_id_; }
private:
- virtual ~CrashedExtensionInfoBarDelegate();
+ virtual ~CrashedExtensionInfoBarDelegate();
- // ConfirmInfoBarDelegate
+ // ConfirmInfoBarDelegate:
virtual bool ShouldExpire(
const NavigationController::LoadCommittedDetails& details) const;
virtual void InfoBarClosed();
@@ -39,8 +39,7 @@ class CrashedExtensionInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual CrashedExtensionInfoBarDelegate* AsCrashedExtensionInfoBarDelegate();
virtual string16 GetMessageText() const;
virtual int GetButtons() const;
- virtual string16 GetButtonLabel(
- ConfirmInfoBarDelegate::InfoBarButton button) const;
+ virtual string16 GetButtonLabel(InfoBarButton button) const;
virtual bool Accept();
ExtensionService* extensions_service_;
diff --git a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
index bd01595..121bd0f 100644
--- a/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
+++ b/chrome/browser/extensions/extension_crash_recovery_browsertest.cc
@@ -28,20 +28,20 @@ class ExtensionCrashRecoveryTest : public ExtensionBrowserTest {
return browser()->profile()->GetExtensionProcessManager();
}
- ConfirmInfoBarDelegate* GetInfoBarDelegate(int index) {
+ ConfirmInfoBarDelegate* GetInfoBarDelegate(size_t index) {
TabContents* current_tab = browser()->GetSelectedTabContents();
- EXPECT_LT(index, current_tab->infobar_delegate_count());
+ EXPECT_LT(index, current_tab->infobar_count());
return current_tab->GetInfoBarDelegateAt(index)->AsConfirmInfoBarDelegate();
}
- void AcceptInfoBar(int index) {
+ void AcceptInfoBar(size_t index) {
ConfirmInfoBarDelegate* infobar = GetInfoBarDelegate(index);
ASSERT_TRUE(infobar);
infobar->Accept();
WaitForExtensionLoad();
}
- void CancelInfoBar(int index) {
+ void CancelInfoBar(size_t index) {
ConfirmInfoBarDelegate* infobar = GetInfoBarDelegate(index);
ASSERT_TRUE(infobar);
infobar->Cancel();
@@ -157,7 +157,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest, ReloadIndependently) {
// The infobar should automatically hide after the extension is successfully
// reloaded.
- ASSERT_EQ(0, current_tab->infobar_delegate_count());
+ ASSERT_EQ(0U, current_tab->infobar_count());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
@@ -169,14 +169,14 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TabContents* original_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(original_tab);
- ASSERT_EQ(1, original_tab->infobar_delegate_count());
+ ASSERT_EQ(1U, original_tab->infobar_count());
// Open a new tab so the info bar will not be in the current tab.
browser()->NewTab();
TabContents* new_current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(new_current_tab);
ASSERT_NE(new_current_tab, original_tab);
- ASSERT_EQ(0, new_current_tab->infobar_delegate_count());
+ ASSERT_EQ(0U, new_current_tab->infobar_count());
ReloadExtension(first_extension_id_);
@@ -185,7 +185,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
// The infobar should automatically hide after the extension is successfully
// reloaded.
- ASSERT_EQ(0, original_tab->infobar_delegate_count());
+ ASSERT_EQ(0U, original_tab->infobar_count());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
@@ -197,13 +197,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TabContents* current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(current_tab);
- ASSERT_EQ(1, current_tab->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab->infobar_count());
// Navigate to another page.
ui_test_utils::NavigateToURL(browser(),
ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory),
FilePath(FILE_PATH_LITERAL("title1.html"))));
- ASSERT_EQ(1, current_tab->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab->infobar_count());
ReloadExtension(first_extension_id_);
@@ -212,7 +212,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
// The infobar should automatically hide after the extension is successfully
// reloaded.
- ASSERT_EQ(0, current_tab->infobar_delegate_count());
+ ASSERT_EQ(0U, current_tab->infobar_count());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
@@ -228,11 +228,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TabContents* current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(current_tab);
- ASSERT_EQ(1, current_tab->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab->infobar_count());
TabContents* current_tab2 = browser2->GetSelectedTabContents();
ASSERT_TRUE(current_tab2);
- ASSERT_EQ(1, current_tab2->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab2->infobar_count());
ReloadExtension(first_extension_id_);
@@ -241,8 +241,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
// Both infobars should automatically hide after the extension is successfully
// reloaded.
- ASSERT_EQ(0, current_tab->infobar_delegate_count());
- ASSERT_EQ(0, current_tab2->infobar_delegate_count());
+ ASSERT_EQ(0U, current_tab->infobar_count());
+ ASSERT_EQ(0U, current_tab2->infobar_count());
}
IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
@@ -258,11 +258,11 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TabContents* current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(current_tab);
- ASSERT_EQ(1, current_tab->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab->infobar_count());
TabContents* current_tab2 = browser2->GetSelectedTabContents();
ASSERT_TRUE(current_tab2);
- ASSERT_EQ(1, current_tab2->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab2->infobar_count());
// Move second window into first browser so there will be multiple tabs
// with the info bar for the same extension in one browser.
@@ -270,7 +270,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
browser2->tabstrip_model()->DetachTabContentsAt(0);
browser()->tabstrip_model()->AppendTabContents(contents, true);
current_tab2 = browser()->GetSelectedTabContents();
- ASSERT_EQ(1, current_tab2->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab2->infobar_count());
ASSERT_NE(current_tab2, current_tab);
ReloadExtension(first_extension_id_);
@@ -280,10 +280,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
// Both infobars should automatically hide after the extension is successfully
// reloaded.
- ASSERT_EQ(0, current_tab2->infobar_delegate_count());
+ ASSERT_EQ(0U, current_tab2->infobar_count());
browser()->SelectPreviousTab();
ASSERT_EQ(current_tab, browser()->GetSelectedTabContents());
- ASSERT_EQ(0, current_tab->infobar_delegate_count());
+ ASSERT_EQ(0U, current_tab->infobar_count());
}
// Make sure that when we don't do anything about the crashed extension
@@ -422,10 +422,10 @@ IN_PROC_BROWSER_TEST_F(ExtensionCrashRecoveryTest,
TabContents* current_tab = browser()->GetSelectedTabContents();
ASSERT_TRUE(current_tab);
// At the beginning we should have one infobar displayed for each extension.
- ASSERT_EQ(2, current_tab->infobar_delegate_count());
+ ASSERT_EQ(2U, current_tab->infobar_count());
ReloadExtension(first_extension_id_);
// One of the infobars should hide after the extension is reloaded.
- ASSERT_EQ(1, current_tab->infobar_delegate_count());
+ ASSERT_EQ(1U, current_tab->infobar_count());
CheckExtensionConsistency(size_before);
}
diff --git a/chrome/browser/extensions/extension_infobar_delegate.h b/chrome/browser/extensions/extension_infobar_delegate.h
index 43ca959..95f73aa 100644
--- a/chrome/browser/extensions/extension_infobar_delegate.h
+++ b/chrome/browser/extensions/extension_infobar_delegate.h
@@ -31,12 +31,13 @@ class ExtensionInfoBarDelegate : public InfoBarDelegate,
TabContents* contents,
const Extension* extension,
const GURL& url);
+
const Extension* extension() { return extension_; }
ExtensionHost* extension_host() { return extension_host_.get(); }
void set_observer(DelegateObserver* observer) { observer_ = observer; }
- bool closing() { return closing_; }
+ bool closing() const { return closing_; }
private:
virtual ~ExtensionInfoBarDelegate();
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index 0ab5692..61e9ce2 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -248,7 +248,7 @@ void ExtensionInstallUI::ShowThemeInfoBar(const std::string& previous_theme_id,
// First find any previous theme preview infobars.
InfoBarDelegate* old_delegate = NULL;
- for (int i = 0; i < tab_contents->infobar_delegate_count(); ++i) {
+ for (size_t i = 0; i < tab_contents->infobar_count(); ++i) {
InfoBarDelegate* delegate = tab_contents->GetInfoBarDelegateAt(i);
ThemeInstalledInfoBarDelegate* theme_infobar =
delegate->AsThemePreviewInfobarDelegate();
diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc
index 327a923..3cf6564 100644
--- a/chrome/browser/extensions/extension_install_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc
@@ -22,12 +22,12 @@ class ExtensionInstallUIBrowserTest : public ExtensionBrowserTest {
void VerifyThemeInfoBarAndUndoInstall() {
TabContents* tab_contents = browser()->GetSelectedTabContents();
ASSERT_TRUE(tab_contents);
- ASSERT_EQ(1, tab_contents->infobar_delegate_count());
+ ASSERT_EQ(1U, tab_contents->infobar_count());
ConfirmInfoBarDelegate* delegate =
tab_contents->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate();
ASSERT_TRUE(delegate);
delegate->Cancel();
- ASSERT_EQ(0, tab_contents->infobar_delegate_count());
+ ASSERT_EQ(0U, tab_contents->infobar_count());
}
};
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
index 402e108..308516c 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
@@ -33,7 +33,7 @@ ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate(
NotificationService::AllSources());
}
-bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) {
+bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) const {
return theme && (theme->id() == theme_id_);
}
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.h b/chrome/browser/extensions/theme_installed_infobar_delegate.h
index 94db6bb..c565a33 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.h
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.h
@@ -24,7 +24,7 @@ class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate,
// Returns true if the given theme is the same as the one associated with this
// info bar.
- bool MatchesTheme(const Extension* theme);
+ bool MatchesTheme(const Extension* theme) const;
protected:
virtual ~ThemeInstalledInfoBarDelegate();