Commit f78c7c44 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Extensions] Move BrowserExtensionWindowController to extensions namespace

TBR=sky@chromium.org

Bug: 117261
Change-Id: I4a8e646354e97d3ecbbf2e6889ff9c2217f17995
Reviewed-on: https://chromium-review.googlesource.com/1069222
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarIstiaque Ahmed <lazyboy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560763}
parent 89bddcd4
......@@ -16,32 +16,32 @@
#include "components/sessions/core/session_id.h"
#include "extensions/common/extension.h"
namespace extensions {
BrowserExtensionWindowController::BrowserExtensionWindowController(
Browser* browser)
: extensions::WindowController(browser->window(), browser->profile()),
: WindowController(browser->window(), browser->profile()),
browser_(browser) {
extensions::WindowControllerList::GetInstance()->AddExtensionWindow(this);
WindowControllerList::GetInstance()->AddExtensionWindow(this);
}
BrowserExtensionWindowController::~BrowserExtensionWindowController() {
extensions::WindowControllerList::GetInstance()->RemoveExtensionWindow(this);
WindowControllerList::GetInstance()->RemoveExtensionWindow(this);
}
int BrowserExtensionWindowController::GetWindowId() const {
return static_cast<int>(browser_->session_id().id());
}
namespace keys = extensions::tabs_constants;
std::string BrowserExtensionWindowController::GetWindowTypeText() const {
return extensions::ExtensionTabUtil::GetBrowserWindowTypeText(*browser_);
return ExtensionTabUtil::GetBrowserWindowTypeText(*browser_);
}
bool BrowserExtensionWindowController::CanClose(Reason* reason) const {
// Don't let an extension remove the window if the user is dragging tabs
// in that window.
if (!browser_->window()->IsTabStripEditable()) {
*reason = extensions::WindowController::REASON_NOT_EDITABLE;
*reason = WindowController::REASON_NOT_EDITABLE;
return false;
}
return true;
......@@ -59,7 +59,7 @@ Browser* BrowserExtensionWindowController::GetBrowser() const {
}
bool BrowserExtensionWindowController::IsVisibleToTabsAPIForExtension(
const extensions::Extension* extension,
const Extension* extension,
bool allow_dev_tools_windows) const {
DCHECK(extension);
// Platform apps can only see their own windows.
......@@ -68,3 +68,5 @@ bool BrowserExtensionWindowController::IsVisibleToTabsAPIForExtension(
return !browser_->is_devtools() || allow_dev_tools_windows;
}
} // namespace extensions
......@@ -12,14 +12,13 @@ class Browser;
namespace extensions {
class Extension;
}
class BrowserExtensionWindowController : public extensions::WindowController {
class BrowserExtensionWindowController : public WindowController {
public:
explicit BrowserExtensionWindowController(Browser* browser);
~BrowserExtensionWindowController() override;
// extensions::WindowController implementation.
// WindowController implementation.
int GetWindowId() const override;
std::string GetWindowTypeText() const override;
bool CanClose(Reason* reason) const override;
......@@ -27,7 +26,7 @@ class BrowserExtensionWindowController : public extensions::WindowController {
const GURL& extension_url) const override;
Browser* GetBrowser() const override;
bool IsVisibleToTabsAPIForExtension(
const extensions::Extension* extension,
const Extension* extension,
bool allow_dev_tools_windows) const override;
private:
......@@ -36,4 +35,6 @@ class BrowserExtensionWindowController : public extensions::WindowController {
DISALLOW_COPY_AND_ASSIGN(BrowserExtensionWindowController);
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_BROWSER_EXTENSION_WINDOW_CONTROLLER_H_
......@@ -454,7 +454,7 @@ Browser::Browser(const CreateParams& params)
// Create the extension window controller before sending notifications.
extension_window_controller_.reset(
new BrowserExtensionWindowController(this));
new extensions::BrowserExtensionWindowController(this));
SessionService* session_service =
SessionServiceFactory::GetForProfileForSessionRestore(profile_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment