summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/api/debugger/debugger_api.cc50
-rw-r--r--chrome/browser/extensions/extension_infobar_delegate.cc13
-rw-r--r--chrome/browser/extensions/extension_infobar_delegate.h3
-rw-r--r--chrome/browser/extensions/extension_install_ui_browsertest.cc2
-rw-r--r--chrome/browser/extensions/theme_installed_infobar_delegate.cc8
-rw-r--r--chrome/browser/extensions/theme_installed_infobar_delegate.h4
6 files changed, 42 insertions, 38 deletions
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index bdf9722..07756c8 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -68,7 +68,9 @@ namespace OnDetach = extensions::api::debugger::OnDetach;
namespace OnEvent = extensions::api::debugger::OnEvent;
namespace SendCommand = extensions::api::debugger::SendCommand;
+namespace {
class ExtensionDevToolsInfoBarDelegate;
+} // namespace
// ExtensionDevToolsClientHost ------------------------------------------------
@@ -123,13 +125,31 @@ class ExtensionDevToolsClientHost : public DevToolsClientHost,
DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsClientHost);
};
+// The member function declarations come after the other class declarations, so
+// they can call members on them.
+
+
+namespace {
+
+// Helpers --------------------------------------------------------------------
+
+void CopyDebuggee(Debuggee* dst, const Debuggee& src) {
+ if (src.tab_id)
+ dst->tab_id.reset(new int(*src.tab_id));
+ if (src.extension_id)
+ dst->extension_id.reset(new std::string(*src.extension_id));
+ if (src.target_id)
+ dst->target_id.reset(new std::string(*src.target_id));
+}
+
// ExtensionDevToolsInfoBarDelegate -------------------------------------------
class ExtensionDevToolsInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
- // Creates an extension dev tools delegate and adds it to |infobar_service|.
- // Returns a pointer to the delegate if it was successfully added.
+ // Creates an extension dev tools infobar delegate and adds it to the
+ // InfoBarService associated with |rvh|. Returns the delegate if it was
+ // successfully added.
static ExtensionDevToolsInfoBarDelegate* Create(
RenderViewHost* rvh,
const std::string& client_name);
@@ -214,26 +234,11 @@ int ExtensionDevToolsInfoBarDelegate::GetButtons() const {
}
bool ExtensionDevToolsInfoBarDelegate::Cancel() {
- if (client_host_)
- client_host_->MarkAsDismissed();
+ InfoBarDismissed();
return true;
}
-namespace {
-
-// Helpers --------------------------------------------------------------------
-
-void CopyDebuggee(Debuggee* dst, const Debuggee& src) {
- if (src.tab_id)
- dst->tab_id.reset(new int(*src.tab_id));
- if (src.extension_id)
- dst->extension_id.reset(new std::string(*src.extension_id));
- if (src.target_id)
- dst->target_id.reset(new std::string(*src.target_id));
-}
-
-
// AttachedClientHosts --------------------------------------------------------
class AttachedClientHosts {
@@ -261,6 +266,7 @@ AttachedClientHosts::AttachedClientHosts() {
AttachedClientHosts::~AttachedClientHosts() {
}
+
// static
AttachedClientHosts* AttachedClientHosts::GetInstance() {
return Singleton<AttachedClientHosts>::get();
@@ -341,10 +347,8 @@ ExtensionDevToolsClientHost::~ExtensionDevToolsClientHost() {
if (infobar_delegate_) {
infobar_delegate_->set_client_host(NULL);
- InfoBarService* infobar_service = InfoBarService::FromWebContents(
- WebContents::FromRenderViewHost(agent_host_->GetRenderViewHost()));
- if (infobar_service)
- infobar_service->RemoveInfoBar(infobar_delegate_);
+ InfoBarService::FromWebContents(WebContents::FromRenderViewHost(
+ agent_host_->GetRenderViewHost()))->RemoveInfoBar(infobar_delegate_);
}
AttachedClientHosts::GetInstance()->Remove(this);
}
@@ -463,7 +467,7 @@ void ExtensionDevToolsClientHost::DispatchOnInspectorFrontend(
// DebuggerFunction -----------------------------------------------------------
DebuggerFunction::DebuggerFunction()
- : client_host_(0) {
+ : client_host_(NULL) {
}
DebuggerFunction::~DebuggerFunction() {
diff --git a/chrome/browser/extensions/extension_infobar_delegate.cc b/chrome/browser/extensions/extension_infobar_delegate.cc
index 0bcedd3..a752583 100644
--- a/chrome/browser/extensions/extension_infobar_delegate.cc
+++ b/chrome/browser/extensions/extension_infobar_delegate.cc
@@ -30,7 +30,7 @@ void ExtensionInfoBarDelegate::Create(InfoBarService* infobar_service,
int height) {
infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
new ExtensionInfoBarDelegate(browser, infobar_service, extension, url,
- height)));
+ infobar_service->web_contents(), height)));
}
ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(
@@ -38,6 +38,7 @@ ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(
InfoBarService* infobar_service,
const extensions::Extension* extension,
const GURL& url,
+ content::WebContents* web_contents,
int height)
: InfoBarDelegate(infobar_service),
#if defined(TOOLKIT_VIEWS)
@@ -49,23 +50,21 @@ ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(
ExtensionProcessManager* manager =
extensions::ExtensionSystem::Get(browser->profile())->process_manager();
extension_host_.reset(manager->CreateInfobarHost(url, browser));
- extension_host_->SetAssociatedWebContents(infobar_service->web_contents());
+ extension_host_->SetAssociatedWebContents(web_contents);
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
content::Source<Profile>(browser->profile()));
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
content::Source<Profile>(browser->profile()));
-#if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK)
+#if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) || defined(OS_ANDROID)
+ // TODO(dtrainor): On Android, this is not used. Might need to pull this from
+ // Android UI level in the future. Tracked via issue 115303.
int default_height = InfoBar::kDefaultBarTargetHeight;
#elif defined(OS_MACOSX)
// TODO(pkasting): Once Infobars have been ported to Mac, we can remove the
// ifdefs and just use the Infobar constant below.
int default_height = 36;
-#elif defined(OS_ANDROID)
- // TODO(dtrainor): This is not used. Might need to pull this from Android UI
- // level in the future. Tracked via issue 115303.
- int default_height = 36;
#endif
height_ = std::max(0, height);
height_ = std::min(2 * default_height, height_);
diff --git a/chrome/browser/extensions/extension_infobar_delegate.h b/chrome/browser/extensions/extension_infobar_delegate.h
index a8a2f62..0d549d7 100644
--- a/chrome/browser/extensions/extension_infobar_delegate.h
+++ b/chrome/browser/extensions/extension_infobar_delegate.h
@@ -35,7 +35,7 @@ class ExtensionInfoBarDelegate : public InfoBarDelegate,
virtual ~ExtensionInfoBarDelegate();
- // Creates an extension delegate and adds it to |infobar_service|.
+ // Creates an extension infobar delegate and adds it to |infobar_service|.
static void Create(InfoBarService* infobar_service,
Browser* browser,
const extensions::Extension* extension,
@@ -55,6 +55,7 @@ class ExtensionInfoBarDelegate : public InfoBarDelegate,
InfoBarService* infobar_service,
const extensions::Extension* extension,
const GURL& url,
+ content::WebContents* web_contents,
int height);
// InfoBarDelegate:
diff --git a/chrome/browser/extensions/extension_install_ui_browsertest.cc b/chrome/browser/extensions/extension_install_ui_browsertest.cc
index cc059f1..a44592f 100644
--- a/chrome/browser/extensions/extension_install_ui_browsertest.cc
+++ b/chrome/browser/extensions/extension_install_ui_browsertest.cc
@@ -8,7 +8,7 @@
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_sorting.h"
-#include "chrome/browser/extensions/theme_installed_infobar_delegate.h"
+#include "chrome/browser/infobars/confirm_infobar_delegate.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
index 3a0ae75..be6ede8 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc
@@ -54,15 +54,15 @@ void ThemeInstalledInfoBarDelegate::Create(
// If there's a previous theme infobar, just replace that instead of adding a
// new one.
for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
- InfoBarDelegate* delegate = infobar_service->infobar_at(i);
+ InfoBarDelegate* old_infobar = infobar_service->infobar_at(i);
ThemeInstalledInfoBarDelegate* theme_infobar =
- delegate->AsThemePreviewInfobarDelegate();
+ old_infobar->AsThemePreviewInfobarDelegate();
if (theme_infobar) {
// If the user installed the same theme twice, ignore the second install
// and keep the first install info bar, so that they can easily undo to
// get back the previous theme.
if (theme_infobar->theme_id_ != new_theme->id()) {
- infobar_service->ReplaceInfoBar(delegate, new_infobar.Pass());
+ infobar_service->ReplaceInfoBar(old_infobar, new_infobar.Pass());
theme_service->OnInfobarDisplayed();
}
return;
@@ -135,7 +135,7 @@ bool ThemeInstalledInfoBarDelegate::Cancel() {
extension_service_->GetExtensionById(previous_theme_id_, true);
if (previous_theme) {
theme_service_->SetTheme(previous_theme);
- return false; // The theme change will close us.
+ return false; // The theme change will close us.
}
}
diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.h b/chrome/browser/extensions/theme_installed_infobar_delegate.h
index 14ba85d..f37efcc 100644
--- a/chrome/browser/extensions/theme_installed_infobar_delegate.h
+++ b/chrome/browser/extensions/theme_installed_infobar_delegate.h
@@ -26,8 +26,8 @@ class Extension;
class ThemeInstalledInfoBarDelegate : public ConfirmInfoBarDelegate,
public content::NotificationObserver {
public:
- // Creates a theme installed delegate and adds it to the last active tab on
- // |profile|.
+ // Creates a theme installed infobar delegate and adds it to the last active
+ // tab on |profile|.
static void Create(const extensions::Extension* new_theme,
Profile* profile,
const std::string& previous_theme_id,