summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_tab_helper.cc9
-rw-r--r--chrome/browser/extensions/extension_tab_helper.h7
-rw-r--r--chrome/browser/extensions/extension_tab_helper_delegate.cc18
-rw-r--r--chrome/browser/extensions/extension_tab_helper_delegate.h29
-rw-r--r--chrome/browser/ui/browser.cc1
-rw-r--r--chrome/browser/ui/browser.h15
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.cc10
-rw-r--r--chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h9
-rw-r--r--chrome/chrome_browser.gypi2
9 files changed, 71 insertions, 29 deletions
diff --git a/chrome/browser/extensions/extension_tab_helper.cc b/chrome/browser/extensions/extension_tab_helper.cc
index 1d1aa08..94e90b2 100644
--- a/chrome/browser/extensions/extension_tab_helper.cc
+++ b/chrome/browser/extensions/extension_tab_helper.cc
@@ -26,6 +26,7 @@
ExtensionTabHelper::ExtensionTabHelper(TabContentsWrapper* wrapper)
: TabContentsObserver(wrapper->tab_contents()),
+ delegate_(NULL),
extension_app_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(
extension_function_dispatcher_(wrapper->profile(), this)),
@@ -140,13 +141,13 @@ void ExtensionTabHelper::OnDidGetApplicationInfo(
int32 page_id, const WebApplicationInfo& info) {
web_app_info_ = info;
- if (wrapper_->delegate())
- wrapper_->delegate()->OnDidGetApplicationInfo(wrapper_, page_id);
+ if (delegate_)
+ delegate_->OnDidGetApplicationInfo(wrapper_, page_id);
}
void ExtensionTabHelper::OnInstallApplication(const WebApplicationInfo& info) {
- if (wrapper_->delegate())
- wrapper_->delegate()->OnInstallApplication(wrapper_, info);
+ if (delegate_)
+ delegate_->OnInstallApplication(wrapper_, info);
}
void ExtensionTabHelper::OnInlineWebstoreInstall(
diff --git a/chrome/browser/extensions/extension_tab_helper.h b/chrome/browser/extensions/extension_tab_helper.h
index 7310aaa..0d3fd12 100644
--- a/chrome/browser/extensions/extension_tab_helper.h
+++ b/chrome/browser/extensions/extension_tab_helper.h
@@ -16,6 +16,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
class Extension;
+class ExtensionTabHelperDelegate;
class TabContentsWrapper;
struct WebApplicationInfo;
@@ -38,6 +39,9 @@ class ExtensionTabHelper
// Copies the internal state from another ExtensionTabHelper.
void CopyStateFrom(const ExtensionTabHelper& source);
+ ExtensionTabHelperDelegate* delegate() const { return delegate_; }
+ void set_delegate(ExtensionTabHelperDelegate* d) { delegate_ = d; }
+
// Call this after updating a page action to notify clients about the changes.
void PageActionStateChanged();
@@ -134,6 +138,9 @@ class ExtensionTabHelper
// Data for app extensions ---------------------------------------------------
+ // Delegate for notifying our owner about stuff. Not owned by us.
+ ExtensionTabHelperDelegate* delegate_;
+
// If non-null this tab is an app tab and this is the extension the tab was
// created for.
const Extension* extension_app_;
diff --git a/chrome/browser/extensions/extension_tab_helper_delegate.cc b/chrome/browser/extensions/extension_tab_helper_delegate.cc
new file mode 100644
index 0000000..0f6a2db
--- /dev/null
+++ b/chrome/browser/extensions/extension_tab_helper_delegate.cc
@@ -0,0 +1,18 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/extensions/extension_tab_helper_delegate.h"
+
+ExtensionTabHelperDelegate::~ExtensionTabHelperDelegate() {
+}
+
+// Notification when an application programmatically requests installation.
+void ExtensionTabHelperDelegate::OnInstallApplication(
+ TabContentsWrapper* source,
+ const WebApplicationInfo& app_info) {
+}
+
+void ExtensionTabHelperDelegate::OnDidGetApplicationInfo(
+ TabContentsWrapper* source, int32 page_id) {
+}
diff --git a/chrome/browser/extensions/extension_tab_helper_delegate.h b/chrome/browser/extensions/extension_tab_helper_delegate.h
new file mode 100644
index 0000000..ac26f4e
--- /dev/null
+++ b/chrome/browser/extensions/extension_tab_helper_delegate.h
@@ -0,0 +1,29 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_DELEGATE_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_DELEGATE_H_
+#pragma once
+
+#include "base/basictypes.h"
+
+class TabContentsWrapper;
+struct WebApplicationInfo;
+
+// Objects implement this interface to get notified about changes in the
+// ExtensionTabHelper and to provide necessary functionality.
+class ExtensionTabHelperDelegate {
+ public:
+ // Notification that a user's request to install an application has completed.
+ virtual void OnDidGetApplicationInfo(TabContentsWrapper* source,
+ int32 page_id);
+
+ // Notification when an application programmatically requests installation.
+ virtual void OnInstallApplication(TabContentsWrapper* source,
+ const WebApplicationInfo& app_info);
+ protected:
+ virtual ~ExtensionTabHelperDelegate();
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TAB_HELPER_DELEGATE_H_
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index b207e72..edf0807 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -4989,6 +4989,7 @@ void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) {
tab->blocked_content_tab_helper()->set_delegate(delegate);
tab->bookmark_tab_helper()->set_delegate(delegate);
tab->constrained_window_tab_helper()->set_delegate(delegate);
+ tab->extension_tab_helper()->set_delegate(delegate);
tab->search_engine_tab_helper()->set_delegate(delegate);
}
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 37456d3..c011431 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -19,6 +19,7 @@
#include "base/string16.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/debugger/devtools_toggle_action.h"
+#include "chrome/browser/extensions/extension_tab_helper_delegate.h"
#include "chrome/browser/event_disposition.h"
#include "chrome/browser/instant/instant_delegate.h"
#include "chrome/browser/prefs/pref_member.h"
@@ -80,6 +81,7 @@ class Browser : public TabHandlerDelegate,
public ConstrainedWindowTabHelperDelegate,
public BlockedContentTabHelperDelegate,
public BookmarkTabHelperDelegate,
+ public ExtensionTabHelperDelegate,
public PageNavigator,
public CommandUpdater::CommandUpdaterDelegate,
public content::NotificationObserver,
@@ -1028,12 +1030,6 @@ class Browser : public TabHandlerDelegate,
virtual void LostMouseLock() OVERRIDE;
// Overridden from TabContentsWrapperDelegate:
- virtual void OnDidGetApplicationInfo(TabContentsWrapper* source,
- int32 page_id) OVERRIDE;
- virtual void OnInstallApplication(
- TabContentsWrapper* source,
- const WebApplicationInfo& app_info) OVERRIDE;
-
// Note that the caller is responsible for deleting |old_tab_contents|.
virtual void SwapTabContents(TabContentsWrapper* old_tab_contents,
TabContentsWrapper* new_tab_contents) OVERRIDE;
@@ -1057,6 +1053,13 @@ class Browser : public TabHandlerDelegate,
virtual void URLStarredChanged(TabContentsWrapper* source,
bool starred) OVERRIDE;
+ // Overridden from ExtensionTabHelperDelegate:
+ virtual void OnDidGetApplicationInfo(TabContentsWrapper* source,
+ int32 page_id) OVERRIDE;
+ virtual void OnInstallApplication(
+ TabContentsWrapper* source,
+ const WebApplicationInfo& app_info) OVERRIDE;
+
// Overridden from SelectFileDialog::Listener:
virtual void FileSelected(const FilePath& path,
int index,
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.cc
index 750c29e..61a2718 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.cc
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.cc
@@ -6,13 +6,3 @@
TabContentsWrapperDelegate::~TabContentsWrapperDelegate() {
}
-
-// Notification when an application programmatically requests installation.
-void TabContentsWrapperDelegate::OnInstallApplication(
- TabContentsWrapper* source,
- const WebApplicationInfo& app_info) {
-}
-
-void TabContentsWrapperDelegate::OnDidGetApplicationInfo(
- TabContentsWrapper* source, int32 page_id) {
-}
diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h b/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h
index 3862f55..86924d2 100644
--- a/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h
+++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper_delegate.h
@@ -9,20 +9,11 @@
#include "base/basictypes.h"
class TabContentsWrapper;
-struct WebApplicationInfo;
// Objects implement this interface to get notified about changes in the
// TabContentsWrapper and to provide necessary functionality.
class TabContentsWrapperDelegate {
public:
- // Notification that a user's request to install an application has completed.
- virtual void OnDidGetApplicationInfo(TabContentsWrapper* source,
- int32 page_id);
-
- // Notification when an application programmatically requests installation.
- virtual void OnInstallApplication(TabContentsWrapper* source,
- const WebApplicationInfo& app_info);
-
virtual void SwapTabContents(TabContentsWrapper* old_tc,
TabContentsWrapper* new_tc) = 0;
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index daaf61e..72988cc 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1110,6 +1110,8 @@
'browser/extensions/extension_sync_data.h',
'browser/extensions/extension_tab_helper.cc',
'browser/extensions/extension_tab_helper.h',
+ 'browser/extensions/extension_tab_helper_delegate.cc',
+ 'browser/extensions/extension_tab_helper_delegate.h',
'browser/extensions/extension_tab_id_map.cc',
'browser/extensions/extension_tab_id_map.h',
'browser/extensions/extension_tab_util.cc',