| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/browser_extension_window_controller.h" | 5 #include "chrome/browser/extensions/browser_extension_window_controller.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 7 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
| 8 #include "chrome/browser/extensions/extension_tab_util.h" | 8 #include "chrome/browser/extensions/extension_tab_util.h" |
| 9 #include "chrome/browser/extensions/window_controller_list.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sessions/session_id.h" | 11 #include "chrome/browser/sessions/session_id.h" |
| 11 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_tabstrip.h" | 13 #include "chrome/browser/ui/browser_tabstrip.h" |
| 13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
| 14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
| 15 | 16 |
| 16 BrowserExtensionWindowController::BrowserExtensionWindowController( | 17 BrowserExtensionWindowController::BrowserExtensionWindowController( |
| 17 Browser* browser) | 18 Browser* browser) |
| 18 : extensions::WindowController(browser->window(), browser->profile()), | 19 : extensions::WindowController(browser->window(), browser->profile()), |
| 19 browser_(browser) { | 20 browser_(browser) { |
| 21 extensions::WindowControllerList::GetInstance()->AddExtensionWindow(this); |
| 22 } |
| 23 |
| 24 BrowserExtensionWindowController::~BrowserExtensionWindowController() { |
| 25 extensions::WindowControllerList::GetInstance()->RemoveExtensionWindow(this); |
| 20 } | 26 } |
| 21 | 27 |
| 22 int BrowserExtensionWindowController::GetWindowId() const { | 28 int BrowserExtensionWindowController::GetWindowId() const { |
| 23 return static_cast<int>(browser_->session_id().id()); | 29 return static_cast<int>(browser_->session_id().id()); |
| 24 } | 30 } |
| 25 | 31 |
| 26 namespace keys = extensions::tabs_constants; | 32 namespace keys = extensions::tabs_constants; |
| 27 | 33 |
| 28 std::string BrowserExtensionWindowController::GetWindowTypeText() const { | 34 std::string BrowserExtensionWindowController::GetWindowTypeText() const { |
| 29 if (browser_->is_type_popup()) | 35 if (browser_->is_type_popup()) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 Browser* BrowserExtensionWindowController::GetBrowser() const { | 76 Browser* BrowserExtensionWindowController::GetBrowser() const { |
| 71 return browser_; | 77 return browser_; |
| 72 } | 78 } |
| 73 | 79 |
| 74 bool BrowserExtensionWindowController::IsVisibleToExtension( | 80 bool BrowserExtensionWindowController::IsVisibleToExtension( |
| 75 const extensions::Extension* extension) const { | 81 const extensions::Extension* extension) const { |
| 76 // Platform apps can only see their own windows. | 82 // Platform apps can only see their own windows. |
| 77 // TODO(mihaip): what about non-Aura panels? | 83 // TODO(mihaip): what about non-Aura panels? |
| 78 return !extension->is_platform_app(); | 84 return !extension->is_platform_app(); |
| 79 } | 85 } |
| OLD | NEW |