summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 05:39:58 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-31 05:39:58 +0000
commit91ffbb3a177fb38b831b2a1fdec21de376f5403e (patch)
tree85f5de9a4263334ee71711ebde8f6b3f3c3e72d4 /chrome
parent33bd26d46caad125cc57f7b1d8e68a2a746b1d2e (diff)
downloadchromium_src-91ffbb3a177fb38b831b2a1fdec21de376f5403e.zip
chromium_src-91ffbb3a177fb38b831b2a1fdec21de376f5403e.tar.gz
chromium_src-91ffbb3a177fb38b831b2a1fdec21de376f5403e.tar.bz2
Unify sidebar identification in the chrome.experimental.sidebar extension API implementation.
BUG=51084 TEST=Run interactive_ui_tests and browser_tests. Review URL: http://codereview.chromium.org/3212005 Patch from Aleksey Shlyapnikov <alekseys@google.com>. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57965 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/extensions/extension_sidebar_api.cc3
-rw-r--r--chrome/browser/extensions/extension_sidebar_api.h2
-rw-r--r--chrome/browser/sidebar/sidebar_container.cc4
-rw-r--r--chrome/browser/sidebar/sidebar_container.h3
-rw-r--r--chrome/browser/sidebar/sidebar_manager.cc9
5 files changed, 7 insertions, 14 deletions
diff --git a/chrome/browser/extensions/extension_sidebar_api.cc b/chrome/browser/extensions/extension_sidebar_api.cc
index 9453ac7..e5f693e 100644
--- a/chrome/browser/extensions/extension_sidebar_api.cc
+++ b/chrome/browser/extensions/extension_sidebar_api.cc
@@ -76,8 +76,9 @@ static bool CanUseHost(Extension* extension,
// static
void ExtensionSidebarEventRouter::OnStateChanged(
- Profile* profile, int tab_id, const std::string& content_id,
+ Profile* profile, TabContents* tab, const std::string& content_id,
const std::string& state) {
+ int tab_id = ExtensionTabUtil::GetTabId(tab);
DictionaryValue* details = new DictionaryValue;
details->Set(kTabIdKey, Value::CreateIntegerValue(tab_id));
details->Set(kStateKey, Value::CreateStringValue(state));
diff --git a/chrome/browser/extensions/extension_sidebar_api.h b/chrome/browser/extensions/extension_sidebar_api.h
index e4ab780..7ad2a33 100644
--- a/chrome/browser/extensions/extension_sidebar_api.h
+++ b/chrome/browser/extensions/extension_sidebar_api.h
@@ -24,7 +24,7 @@ class ExtensionSidebarEventRouter {
public:
// Sidebar state changed.
static void OnStateChanged(
- Profile* profile, int tab_id, const std::string& content_id,
+ Profile* profile, TabContents* tab, const std::string& content_id,
const std::string& state);
private:
diff --git a/chrome/browser/sidebar/sidebar_container.cc b/chrome/browser/sidebar/sidebar_container.cc
index 4c73110..73cac8d 100644
--- a/chrome/browser/sidebar/sidebar_container.cc
+++ b/chrome/browser/sidebar/sidebar_container.cc
@@ -36,10 +36,6 @@ void SidebarContainer::SidebarClosing() {
delegate_->UpdateSidebar(this);
}
-int SidebarContainer::GetTabId() const {
- return tab_->controller().session_id().id();
-}
-
void SidebarContainer::Show() {
delegate_->UpdateSidebar(this);
}
diff --git a/chrome/browser/sidebar/sidebar_container.h b/chrome/browser/sidebar/sidebar_container.h
index 9d9eb82..ac74ece 100644
--- a/chrome/browser/sidebar/sidebar_container.h
+++ b/chrome/browser/sidebar/sidebar_container.h
@@ -45,9 +45,6 @@ class SidebarContainer
// Does all the necessary cleanup.
void SidebarClosing();
- // Returns id of the tab this sidebar is linked to.
- int GetTabId() const;
-
// Returns sidebar's content id.
const std::string& content_id() const { return content_id_; }
diff --git a/chrome/browser/sidebar/sidebar_manager.cc b/chrome/browser/sidebar/sidebar_manager.cc
index 3362b71..62c46c14 100644
--- a/chrome/browser/sidebar/sidebar_manager.cc
+++ b/chrome/browser/sidebar/sidebar_manager.cc
@@ -83,14 +83,14 @@ void SidebarManager::NotifyStateChanges(
if (was_active_host != NULL) {
ExtensionSidebarEventRouter::OnStateChanged(
was_active_sidebar_contents->profile(),
- was_active_host->GetTabId(), was_active_host->content_id(),
+ was_active_host->tab_contents(), was_active_host->content_id(),
extension_sidebar_constants::kShownState);
}
if (active_host != NULL) {
ExtensionSidebarEventRouter::OnStateChanged(
active_sidebar_contents->profile(),
- active_host->GetTabId(), active_host->content_id(),
+ active_host->tab_contents(), active_host->content_id(),
extension_sidebar_constants::kActiveState);
}
}
@@ -107,7 +107,7 @@ void SidebarManager::ShowSidebar(TabContents* tab,
host->Show();
ExtensionSidebarEventRouter::OnStateChanged(
- tab->profile(), host->GetTabId(), content_id,
+ tab->profile(), tab, content_id,
extension_sidebar_constants::kShownState);
}
@@ -160,12 +160,11 @@ void SidebarManager::HideSidebar(TabContents* tab,
SidebarContainer* host = GetSidebarContainerFor(tab, content_id);
DCHECK(host);
- int tab_id = host->GetTabId();
UnregisterSidebarContainerFor(tab, content_id);
ExtensionSidebarEventRouter::OnStateChanged(
- tab->profile(), tab_id, content_id,
+ tab->profile(), tab, content_id,
extension_sidebar_constants::kHiddenState);
}