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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 const extensions::Extension* extension, int tab_index) const { | 63 const extensions::Extension* extension, int tab_index) const { |
64 TabStripModel* tab_strip = browser_->tab_strip_model(); | 64 TabStripModel* tab_strip = browser_->tab_strip_model(); |
65 base::DictionaryValue* result = | 65 base::DictionaryValue* result = |
66 extensions::ExtensionTabUtil::CreateTabObject( | 66 extensions::ExtensionTabUtil::CreateTabObject( |
67 tab_strip->GetWebContentsAt(tab_index), tab_strip, tab_index) | 67 tab_strip->GetWebContentsAt(tab_index), tab_strip, tab_index) |
68 ->ToValue() | 68 ->ToValue() |
69 .release(); | 69 .release(); |
70 return result; | 70 return result; |
71 } | 71 } |
72 | 72 |
73 scoped_ptr<extensions::api::tabs::Tab> | 73 std::unique_ptr<extensions::api::tabs::Tab> |
74 BrowserExtensionWindowController::CreateTabObject( | 74 BrowserExtensionWindowController::CreateTabObject( |
75 const extensions::Extension* extension, | 75 const extensions::Extension* extension, |
76 int tab_index) const { | 76 int tab_index) const { |
77 TabStripModel* tab_strip = browser_->tab_strip_model(); | 77 TabStripModel* tab_strip = browser_->tab_strip_model(); |
78 return extensions::ExtensionTabUtil::CreateTabObject( | 78 return extensions::ExtensionTabUtil::CreateTabObject( |
79 tab_strip->GetWebContentsAt(tab_index), tab_strip, tab_index); | 79 tab_strip->GetWebContentsAt(tab_index), tab_strip, tab_index); |
80 } | 80 } |
81 | 81 |
82 bool BrowserExtensionWindowController::CanClose(Reason* reason) const { | 82 bool BrowserExtensionWindowController::CanClose(Reason* reason) const { |
83 // Don't let an extension remove the window if the user is dragging tabs | 83 // Don't let an extension remove the window if the user is dragging tabs |
(...skipping 15 matching lines...) Expand all Loading... |
99 Browser* BrowserExtensionWindowController::GetBrowser() const { | 99 Browser* BrowserExtensionWindowController::GetBrowser() const { |
100 return browser_; | 100 return browser_; |
101 } | 101 } |
102 | 102 |
103 bool BrowserExtensionWindowController::IsVisibleToExtension( | 103 bool BrowserExtensionWindowController::IsVisibleToExtension( |
104 const extensions::Extension* extension) const { | 104 const extensions::Extension* extension) const { |
105 DCHECK(extension); | 105 DCHECK(extension); |
106 // Platform apps can only see their own windows. | 106 // Platform apps can only see their own windows. |
107 return !browser_->is_devtools() && !extension->is_platform_app(); | 107 return !browser_->is_devtools() && !extension->is_platform_app(); |
108 } | 108 } |
OLD | NEW |