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 22 matching lines...) Expand all Loading... | |
33 using content::SiteInstance; | 33 using content::SiteInstance; |
34 using content::WebContents; | 34 using content::WebContents; |
35 | 35 |
36 namespace { | 36 namespace { |
37 static const int kDefaultWidth = 512; | 37 static const int kDefaultWidth = 512; |
38 static const int kDefaultHeight = 384; | 38 static const int kDefaultHeight = 384; |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 namespace internal { | 41 namespace internal { |
42 | 42 |
43 const char kWindowTypeValueShell[] = "shell"; | |
44 | |
43 class ShellWindowController : public ExtensionWindowController { | 45 class ShellWindowController : public ExtensionWindowController { |
44 public: | 46 public: |
45 ShellWindowController(ShellWindow* shell_window, Profile* profile); | 47 ShellWindowController(ShellWindow* shell_window, Profile* profile); |
46 | 48 |
47 // Overriden from ExtensionWindowController | 49 // Overriden from ExtensionWindowController |
48 virtual int GetWindowId() const OVERRIDE; | 50 virtual int GetWindowId() const OVERRIDE; |
49 virtual std::string GetWindowTypeText() const OVERRIDE; | 51 virtual std::string GetWindowTypeText() const OVERRIDE; |
50 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; | 52 virtual base::DictionaryValue* CreateWindowValueWithTabs() const OVERRIDE; |
51 virtual bool CanClose(Reason* reason) const OVERRIDE; | 53 virtual bool CanClose(Reason* reason) const OVERRIDE; |
52 virtual void SetFullscreenMode(bool is_fullscreen, | 54 virtual void SetFullscreenMode(bool is_fullscreen, |
(...skipping 12 matching lines...) Expand all Loading... | |
65 Profile* profile) | 67 Profile* profile) |
66 : ExtensionWindowController(shell_window, profile), | 68 : ExtensionWindowController(shell_window, profile), |
67 shell_window_(shell_window) { | 69 shell_window_(shell_window) { |
68 } | 70 } |
69 | 71 |
70 int ShellWindowController::GetWindowId() const { | 72 int ShellWindowController::GetWindowId() const { |
71 return static_cast<int>(shell_window_->session_id().id()); | 73 return static_cast<int>(shell_window_->session_id().id()); |
72 } | 74 } |
73 | 75 |
74 std::string ShellWindowController::GetWindowTypeText() const { | 76 std::string ShellWindowController::GetWindowTypeText() const { |
75 return extension_tabs_module_constants::kWindowTypeValueShell; | 77 // TODO(jeremya): since this window shouldn't be accessible from the tabs |
78 // API, does it still make sense for it to have a valid window type? Perhaps | |
79 // this should NOTREACHED(). | |
Mihai Parparita -not on Chrome
2012/05/29 06:09:13
NOTREACHED SGTM
jeremya
2012/05/30 01:10:47
Done.
| |
80 return kWindowTypeValueShell; | |
76 } | 81 } |
77 | 82 |
78 base::DictionaryValue* ShellWindowController::CreateWindowValueWithTabs() | 83 base::DictionaryValue* ShellWindowController::CreateWindowValueWithTabs() |
79 const { | 84 const { |
80 return CreateWindowValue(); | 85 return CreateWindowValue(); |
81 } | 86 } |
82 | 87 |
83 bool ShellWindowController::CanClose(Reason* reason) const { | 88 bool ShellWindowController::CanClose(Reason* reason) const { |
84 return true; | 89 return true; |
85 } | 90 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 } | 230 } |
226 | 231 |
227 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { | 232 ExtensionWindowController* ShellWindow::GetExtensionWindowController() const { |
228 return extension_window_controller_.get(); | 233 return extension_window_controller_.get(); |
229 } | 234 } |
230 | 235 |
231 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { | 236 void ShellWindow::OnRequest(const ExtensionHostMsg_Request_Params& params) { |
232 extension_function_dispatcher_.Dispatch(params, | 237 extension_function_dispatcher_.Dispatch(params, |
233 web_contents_->GetRenderViewHost()); | 238 web_contents_->GetRenderViewHost()); |
234 } | 239 } |
OLD | NEW |