Skip to content

Commit

Permalink
Hide sidebar when calling window.close() in extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
ltilve committed May 7, 2015
1 parent cfadda1 commit 39b4dfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chrome/browser/sidebar/sidebar_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "extensions/browser/extension_system.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sidebar/sidebar_manager.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_resource.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
Expand Down Expand Up @@ -73,6 +74,11 @@ SidebarContainer::GetJavaScriptDialogManager(content::WebContents* source) {
return app_modal::JavaScriptDialogManager::GetInstance();
}

void SidebarContainer::CloseContents(content::WebContents* source) {
// Invoke through SidebarManager, as we need to send a notification
SidebarManager::GetInstance()->HideSidebar(tab_, content_id_);
}

const extensions::Extension* SidebarContainer::GetExtension() const {
Profile* profile =
Profile::FromBrowserContext(sidebar_contents_->GetBrowserContext());
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/sidebar/sidebar_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class SidebarContainer : public content::WebContentsDelegate {
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
content::WebContents* source) override;

void CloseContents(content::WebContents *contents) override;

// Returns an extension this sidebar belongs to.
const extensions::Extension* GetExtension() const;

Expand Down

0 comments on commit 39b4dfd

Please sign in to comment.