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/ui/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_process_manager.h" | 7 #include "chrome/browser/extensions/extension_process_manager.h" |
8 #include "chrome/browser/extensions/extension_tabs_module_constants.h" | 8 #include "chrome/browser/extensions/extension_tabs_module_constants.h" |
9 #include "chrome/browser/extensions/extension_window_controller.h" | 9 #include "chrome/browser/extensions/extension_window_controller.h" |
10 #include "chrome/browser/extensions/shell_window_registry.h" | 10 #include "chrome/browser/extensions/shell_window_registry.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 public: | 38 public: |
39 ShellWindowController(ShellWindow* shell_window, Profile* profile); | 39 ShellWindowController(ShellWindow* shell_window, Profile* profile); |
40 | 40 |
41 // Overriden from ExtensionWindowController | 41 // Overriden from ExtensionWindowController |
42 virtual int GetWindowId() const OVERRIDE; | 42 virtual int GetWindowId() const OVERRIDE; |
43 virtual std::string GetWindowTypeText() const OVERRIDE; | 43 virtual std::string GetWindowTypeText() const OVERRIDE; |
44 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; | 44 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; |
45 virtual bool CanClose(Reason* reason) const OVERRIDE; | 45 virtual bool CanClose(Reason* reason) const OVERRIDE; |
46 virtual void SetFullscreenMode(bool is_fullscreen, | 46 virtual void SetFullscreenMode(bool is_fullscreen, |
47 const GURL& extension_url) const OVERRIDE; | 47 const GURL& extension_url) const OVERRIDE; |
| 48 virtual bool IsVisibleToExtension( |
| 49 const extensions::Extension* extension) const OVERRIDE; |
48 | 50 |
49 private: | 51 private: |
50 ShellWindow* shell_window_; | 52 ShellWindow* shell_window_; |
51 | 53 |
52 DISALLOW_COPY_AND_ASSIGN(ShellWindowController); | 54 DISALLOW_COPY_AND_ASSIGN(ShellWindowController); |
53 }; | 55 }; |
54 | 56 |
55 ShellWindowController::ShellWindowController( | 57 ShellWindowController::ShellWindowController( |
56 ShellWindow* shell_window, | 58 ShellWindow* shell_window, |
57 Profile* profile) | 59 Profile* profile) |
(...skipping 16 matching lines...) Expand all Loading... |
74 | 76 |
75 bool ShellWindowController::CanClose(Reason* reason) const { | 77 bool ShellWindowController::CanClose(Reason* reason) const { |
76 return true; | 78 return true; |
77 } | 79 } |
78 | 80 |
79 void ShellWindowController::SetFullscreenMode(bool is_fullscreen, | 81 void ShellWindowController::SetFullscreenMode(bool is_fullscreen, |
80 const GURL& extension_url) const { | 82 const GURL& extension_url) const { |
81 // TODO(mihaip): implement | 83 // TODO(mihaip): implement |
82 } | 84 } |
83 | 85 |
| 86 bool ShellWindowController::IsVisibleToExtension( |
| 87 const extensions::Extension* extension) const { |
| 88 return shell_window_->extension() == extension; |
| 89 } |
| 90 |
84 } // namespace internal | 91 } // namespace internal |
85 | 92 |
86 ShellWindow* ShellWindow::Create(Profile* profile, | 93 ShellWindow* ShellWindow::Create(Profile* profile, |
87 const extensions::Extension* extension, | 94 const extensions::Extension* extension, |
88 const GURL& url) { | 95 const GURL& url) { |
89 // This object will delete itself when the window is closed. | 96 // This object will delete itself when the window is closed. |
90 return ShellWindow::CreateImpl(profile, extension, url); | 97 return ShellWindow::CreateImpl(profile, extension, url); |
91 } | 98 } |
92 | 99 |
93 ShellWindow::ShellWindow(Profile* profile, | 100 ShellWindow::ShellWindow(Profile* profile, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 } | 203 } |
197 | 204 |
198 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { | 205 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { |
199 return extension_window_controller_.get(); | 206 return extension_window_controller_.get(); |
200 } | 207 } |
201 | 208 |
202 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 209 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
203 extension_function_dispatcher_.Dispatch(params, | 210 extension_function_dispatcher_.Dispatch(params, |
204 web_contents_->GetRenderViewHost()); | 211 web_contents_->GetRenderViewHost()); |
205 } | 212 } |
OLD | NEW |