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 23 matching lines...) Expand all Loading... |
34 std::string BrowserExtensionWindowController::GetWindowTypeText() const { | 34 std::string BrowserExtensionWindowController::GetWindowTypeText() const { |
35 if (browser_->is_devtools()) | 35 if (browser_->is_devtools()) |
36 return keys::kWindowTypeValueDevTools; | 36 return keys::kWindowTypeValueDevTools; |
37 if (browser_->is_type_popup()) | 37 if (browser_->is_type_popup()) |
38 return keys::kWindowTypeValuePopup; | 38 return keys::kWindowTypeValuePopup; |
39 if (browser_->is_app()) | 39 if (browser_->is_app()) |
40 return keys::kWindowTypeValueApp; | 40 return keys::kWindowTypeValueApp; |
41 return keys::kWindowTypeValueNormal; | 41 return keys::kWindowTypeValueNormal; |
42 } | 42 } |
43 | 43 |
44 base::DictionaryValue* | 44 std::unique_ptr<base::DictionaryValue> |
45 BrowserExtensionWindowController::CreateWindowValue() const { | |
46 base::DictionaryValue* result = | |
47 extensions::WindowController::CreateWindowValue(); | |
48 return result; | |
49 } | |
50 | |
51 base::DictionaryValue* | |
52 BrowserExtensionWindowController::CreateWindowValueWithTabs( | 45 BrowserExtensionWindowController::CreateWindowValueWithTabs( |
53 const extensions::Extension* extension) const { | 46 const extensions::Extension* extension) const { |
54 base::DictionaryValue* result = CreateWindowValue(); | 47 std::unique_ptr<base::DictionaryValue> result = CreateWindowValue(); |
55 | 48 |
56 result->Set(keys::kTabsKey, | 49 result->Set(keys::kTabsKey, |
57 extensions::ExtensionTabUtil::CreateTabList(browser_, extension)); | 50 extensions::ExtensionTabUtil::CreateTabList(browser_, extension)); |
58 | 51 |
59 return result; | 52 return result; |
60 } | 53 } |
61 | 54 |
62 base::DictionaryValue* BrowserExtensionWindowController::CreateTabValue( | 55 base::DictionaryValue* BrowserExtensionWindowController::CreateTabValue( |
63 const extensions::Extension* extension, int tab_index) const { | 56 const extensions::Extension* extension, int tab_index) const { |
64 TabStripModel* tab_strip = browser_->tab_strip_model(); | 57 TabStripModel* tab_strip = browser_->tab_strip_model(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 Browser* BrowserExtensionWindowController::GetBrowser() const { | 92 Browser* BrowserExtensionWindowController::GetBrowser() const { |
100 return browser_; | 93 return browser_; |
101 } | 94 } |
102 | 95 |
103 bool BrowserExtensionWindowController::IsVisibleToExtension( | 96 bool BrowserExtensionWindowController::IsVisibleToExtension( |
104 const extensions::Extension* extension) const { | 97 const extensions::Extension* extension) const { |
105 DCHECK(extension); | 98 DCHECK(extension); |
106 // Platform apps can only see their own windows. | 99 // Platform apps can only see their own windows. |
107 return !browser_->is_devtools() && !extension->is_platform_app(); | 100 return !browser_->is_devtools() && !extension->is_platform_app(); |
108 } | 101 } |
OLD | NEW |