Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(901)

Unified Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 1152613003: Implement sidebar support for extension action popups (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move SidebarManager to ExtensionSystem and remove notifications Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/browser_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 7711625bd458b5159785d2a47be819a7d7260ac9..edd63e5ba3f0a791a9cb484dd5c11417a4764dc3 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -15,6 +15,8 @@
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/download/download_shelf.h"
+#include "chrome/browser/extensions/sidebar_container.h"
+#include "chrome/browser/extensions/sidebar_manager.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/fullscreen.h"
#include "chrome/browser/profiles/profile.h"
@@ -137,6 +139,10 @@ BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser,
&initial_show_state_);
browser_->search_model()->AddObserver(this);
+
+ extensions::SidebarManager* sidebar_manager =
+ extensions::SidebarManager::GetFromContext(browser_->profile());
+ sidebar_manager->AddObserver(this);
}
BrowserWindowCocoa::~BrowserWindowCocoa() {
@@ -312,6 +318,7 @@ void BrowserWindowCocoa::BookmarkBarStateChanged(
void BrowserWindowCocoa::UpdateDevTools() {
[controller_ updateDevToolsForContents:
browser_->tab_strip_model()->GetActiveWebContents()];
+ UpdateSidebarForContents(browser_->tab_strip_model()->GetActiveWebContents());
}
void BrowserWindowCocoa::UpdateLoadingAnimations(bool should_animate) {
@@ -809,6 +816,13 @@ void BrowserWindowCocoa::CloseAvatarBubbleFromAvatarButton() {
[[controller_ avatarButtonController] closeAvatarBubble];
}
+void BrowserWindowCocoa::UpdateSidebarForContents(
+ content::WebContents* tab_contents) {
+ if (tab_contents == browser_->tab_strip_model()->GetActiveWebContents()) {
+ [controller_ updateSidebarForContents:tab_contents];
+ }
+}
+
int
BrowserWindowCocoa::GetRenderViewHeightInsetWithDetachedBookmarkBar() {
if (browser_->bookmark_bar_state() != BookmarkBar::DETACHED)
@@ -844,3 +858,13 @@ void BrowserWindowCocoa::HideDownloadShelf() {
if (statusBubble)
statusBubble->Hide();
}
+
+void BrowserWindowCocoa::OnSidebarShown(content::WebContents* tab,
+ const std::string& content_id) {
+ UpdateSidebarForContents(tab);
+}
+
+void BrowserWindowCocoa::OnSidebarHidden(content::WebContents* tab,
+ const std::string& content_id) {
+ UpdateSidebarForContents(tab);
+}

Powered by Google App Engine
This is Rietveld 408576698