| 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/extensions/window_controller_list.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 return keys::kWindowTypeValueNormal; | 41 return keys::kWindowTypeValueNormal; |
| 42 } | 42 } |
| 43 | 43 |
| 44 base::DictionaryValue* | 44 base::DictionaryValue* |
| 45 BrowserExtensionWindowController::CreateWindowValue() const { | 45 BrowserExtensionWindowController::CreateWindowValue() const { |
| 46 DictionaryValue* result = extensions::WindowController::CreateWindowValue(); | 46 DictionaryValue* result = extensions::WindowController::CreateWindowValue(); |
| 47 return result; | 47 return result; |
| 48 } | 48 } |
| 49 | 49 |
| 50 base::DictionaryValue* | 50 base::DictionaryValue* |
| 51 BrowserExtensionWindowController::CreateWindowValueWithTabs() const { | 51 BrowserExtensionWindowController::CreateWindowValueWithTabs( |
| 52 const extensions::Extension* extension) const { |
| 52 DictionaryValue* result = CreateWindowValue(); | 53 DictionaryValue* result = CreateWindowValue(); |
| 53 | 54 |
| 54 result->Set(keys::kTabsKey, ExtensionTabUtil::CreateTabList(browser_)); | 55 result->Set(keys::kTabsKey, ExtensionTabUtil::CreateTabList(browser_, |
| 56 extension)); |
| 55 | 57 |
| 56 return result; | 58 return result; |
| 57 } | 59 } |
| 58 | 60 |
| 59 bool BrowserExtensionWindowController::CanClose(Reason* reason) const { | 61 bool BrowserExtensionWindowController::CanClose(Reason* reason) const { |
| 60 // Don't let an extension remove the window if the user is dragging tabs | 62 // Don't let an extension remove the window if the user is dragging tabs |
| 61 // in that window. | 63 // in that window. |
| 62 if (!chrome::IsTabStripEditable(browser_)) { | 64 if (!chrome::IsTabStripEditable(browser_)) { |
| 63 *reason = extensions::WindowController::REASON_NOT_EDITABLE; | 65 *reason = extensions::WindowController::REASON_NOT_EDITABLE; |
| 64 return false; | 66 return false; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 76 Browser* BrowserExtensionWindowController::GetBrowser() const { | 78 Browser* BrowserExtensionWindowController::GetBrowser() const { |
| 77 return browser_; | 79 return browser_; |
| 78 } | 80 } |
| 79 | 81 |
| 80 bool BrowserExtensionWindowController::IsVisibleToExtension( | 82 bool BrowserExtensionWindowController::IsVisibleToExtension( |
| 81 const extensions::Extension* extension) const { | 83 const extensions::Extension* extension) const { |
| 82 // Platform apps can only see their own windows. | 84 // Platform apps can only see their own windows. |
| 83 // TODO(mihaip): what about non-Aura panels? | 85 // TODO(mihaip): what about non-Aura panels? |
| 84 return !extension->is_platform_app(); | 86 return !extension->is_platform_app(); |
| 85 } | 87 } |
| OLD | NEW |