Chromium Code Reviews| 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/api/app_window/app_window_api.h" | 5 #include "chrome/browser/extensions/api/app_window/app_window_api.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/debugger/devtools_window.h" | 10 #include "chrome/browser/debugger/devtools_window.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 namespace app_window = extensions::api::app_window; | 26 namespace app_window = extensions::api::app_window; |
| 27 namespace Create = app_window::Create; | 27 namespace Create = app_window::Create; |
| 28 | 28 |
| 29 namespace extensions { | 29 namespace extensions { |
| 30 | 30 |
| 31 namespace app_window_constants { | 31 namespace app_window_constants { |
| 32 const char kInvalidWindowId[] = | 32 const char kInvalidWindowId[] = |
| 33 "The window id can not be more than 256 characters long."; | 33 "The window id can not be more than 256 characters long."; |
| 34 } | 34 } |
| 35 | 35 |
| 36 const char kPanelTypeOption[] = "panel"; | |
| 36 const char kNoneFrameOption[] = "none"; | 37 const char kNoneFrameOption[] = "none"; |
| 37 const char kHtmlFrameOption[] = "experimental-html"; | 38 const char kHtmlFrameOption[] = "experimental-html"; |
| 38 | 39 |
| 39 namespace { | 40 namespace { |
| 40 | 41 |
| 41 // Opens an inspector window and delays the response to the | 42 // Opens an inspector window and delays the response to the |
| 42 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is | 43 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is |
| 43 // ready to stop on breakpoints in the callback. | 44 // ready to stop on breakpoints in the callback. |
| 44 class DevToolsRestorer : public content::NotificationObserver { | 45 class DevToolsRestorer : public content::NotificationObserver { |
| 45 public: | 46 public: |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 if (bounds->width.get()) | 138 if (bounds->width.get()) |
| 138 create_params.bounds.set_width(*bounds->width.get()); | 139 create_params.bounds.set_width(*bounds->width.get()); |
| 139 if (bounds->height.get()) | 140 if (bounds->height.get()) |
| 140 create_params.bounds.set_height(*bounds->height.get()); | 141 create_params.bounds.set_height(*bounds->height.get()); |
| 141 if (bounds->left.get()) | 142 if (bounds->left.get()) |
| 142 create_params.bounds.set_x(*bounds->left.get()); | 143 create_params.bounds.set_x(*bounds->left.get()); |
| 143 if (bounds->top.get()) | 144 if (bounds->top.get()) |
| 144 create_params.bounds.set_y(*bounds->top.get()); | 145 create_params.bounds.set_y(*bounds->top.get()); |
| 145 } | 146 } |
| 146 | 147 |
| 148 if (options->type.get()) { | |
| 149 if (*options->type == kPanelTypeOption) | |
| 150 create_params.window_type = ShellWindow::WINDOW_TYPE_PANEL; | |
|
jeremya
2012/11/29 02:49:05
If these panels are only allowed for Talk, we shou
stevenjb
2012/11/29 03:11:26
In apps v2 panels are not intended to be restricte
| |
| 151 } | |
| 152 | |
| 147 if (options->frame.get()) { | 153 if (options->frame.get()) { |
| 148 if (*options->frame == kHtmlFrameOption && | 154 if (*options->frame == kHtmlFrameOption && |
| 149 CommandLine::ForCurrentProcess()->HasSwitch( | 155 CommandLine::ForCurrentProcess()->HasSwitch( |
| 150 switches::kEnableExperimentalExtensionApis)) { | 156 switches::kEnableExperimentalExtensionApis)) { |
| 151 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; | 157 create_params.frame = ShellWindow::FRAME_NONE; |
| 152 inject_html_titlebar = true; | 158 inject_html_titlebar = true; |
| 153 } else if (*options->frame == kNoneFrameOption) { | 159 } else if (*options->frame == kNoneFrameOption) { |
| 154 create_params.frame = ShellWindow::CreateParams::FRAME_NONE; | 160 create_params.frame = ShellWindow::FRAME_NONE; |
| 155 } else { | 161 } else { |
| 156 create_params.frame = ShellWindow::CreateParams::FRAME_CHROME; | 162 create_params.frame = ShellWindow::FRAME_CHROME; |
| 157 } | 163 } |
| 158 } | 164 } |
| 159 | 165 |
| 160 gfx::Size& minimum_size = create_params.minimum_size; | 166 gfx::Size& minimum_size = create_params.minimum_size; |
| 161 if (options->min_width.get()) | 167 if (options->min_width.get()) |
| 162 minimum_size.set_width(*options->min_width); | 168 minimum_size.set_width(*options->min_width); |
| 163 if (options->min_height.get()) | 169 if (options->min_height.get()) |
| 164 minimum_size.set_height(*options->min_height); | 170 minimum_size.set_height(*options->min_height); |
| 165 gfx::Size& maximum_size = create_params.maximum_size; | 171 gfx::Size& maximum_size = create_params.maximum_size; |
| 166 if (options->max_width.get()) | 172 if (options->max_width.get()) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { | 227 if (ShellWindowRegistry::Get(profile())->HadDevToolsAttached(created_view)) { |
| 222 new DevToolsRestorer(this, created_view); | 228 new DevToolsRestorer(this, created_view); |
| 223 return true; | 229 return true; |
| 224 } | 230 } |
| 225 | 231 |
| 226 SendResponse(true); | 232 SendResponse(true); |
| 227 return true; | 233 return true; |
| 228 } | 234 } |
| 229 | 235 |
| 230 } // namespace extensions | 236 } // namespace extensions |
| OLD | NEW |