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 "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "apps/app_window_contents.h" | 8 #include "apps/app_window_contents.h" |
9 #include "apps/app_window_registry.h" | 9 #include "apps/app_window_registry.h" |
10 #include "apps/apps_client.h" | 10 #include "apps/apps_client.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 "The color specification could not be parsed."; | 47 "The color specification could not be parsed."; |
48 const char kColorWithFrameNone[] = "Windows with no frame cannot have a color."; | 48 const char kColorWithFrameNone[] = "Windows with no frame cannot have a color."; |
49 const char kInactiveColorWithoutColor[] = | 49 const char kInactiveColorWithoutColor[] = |
50 "frame.inactiveColor must be used with frame.color."; | 50 "frame.inactiveColor must be used with frame.color."; |
51 const char kConflictingBoundsOptions[] = | 51 const char kConflictingBoundsOptions[] = |
52 "The $1 property cannot be specified for both inner and outer bounds."; | 52 "The $1 property cannot be specified for both inner and outer bounds."; |
53 const char kAlwaysOnTopPermission[] = | 53 const char kAlwaysOnTopPermission[] = |
54 "The \"app.window.alwaysOnTop\" permission is required."; | 54 "The \"app.window.alwaysOnTop\" permission is required."; |
55 const char kInvalidUrlParameter[] = | 55 const char kInvalidUrlParameter[] = |
56 "The URL used for window creation must be local for security reasons."; | 56 "The URL used for window creation must be local for security reasons."; |
57 const char kTransparentBackgroundNeedsFrameNone[] = | |
58 "\"transparent_background\" can only be used with \"frame: none\"."; | |
57 } // namespace app_window_constants | 59 } // namespace app_window_constants |
58 | 60 |
59 const char kNoneFrameOption[] = "none"; | 61 const char kNoneFrameOption[] = "none"; |
60 // TODO(benwells): Remove HTML titlebar injection. | 62 // TODO(benwells): Remove HTML titlebar injection. |
61 const char kHtmlFrameOption[] = "experimental-html"; | 63 const char kHtmlFrameOption[] = "experimental-html"; |
62 | 64 |
63 namespace { | 65 namespace { |
64 | 66 |
65 // Opens an inspector window and delays the response to the | 67 // Opens an inspector window and delays the response to the |
66 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is | 68 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV || | 227 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV || |
226 GetExtension()->location() == extensions::Manifest::COMPONENT) { | 228 GetExtension()->location() == extensions::Manifest::COMPONENT) { |
227 if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) { | 229 if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) { |
228 create_params.window_type = AppWindow::WINDOW_TYPE_PANEL; | 230 create_params.window_type = AppWindow::WINDOW_TYPE_PANEL; |
229 } | 231 } |
230 } | 232 } |
231 | 233 |
232 if (!GetFrameOptions(*options, &create_params)) | 234 if (!GetFrameOptions(*options, &create_params)) |
233 return false; | 235 return false; |
234 | 236 |
235 if (options->transparent_background.get() && | 237 if (options->transparent_background.get()) { |
236 (GetExtension()->permissions_data()->HasAPIPermission( | 238 if (create_params.frame != AppWindow::FRAME_NONE) { |
237 APIPermission::kExperimental) || | 239 error_ = app_window_constants::kTransparentBackgroundNeedsFrameNone; |
238 CommandLine::ForCurrentProcess()->HasSwitch( | 240 return false; |
239 switches::kEnableExperimentalExtensionApis))) { | 241 } |
240 create_params.transparent_background = *options->transparent_background; | 242 if (GetExtension()->permissions_data()->HasAPIPermission( |
243 APIPermission::kExperimental) || | |
244 CommandLine::ForCurrentProcess()->HasSwitch( | |
245 switches::kEnableExperimentalExtensionApis)) { | |
246 create_params.transparent_background = *options->transparent_background; | |
247 } | |
levin
2014/07/15 20:40:05
Changes in this file seem unrelated to the rest of
jackhou1
2014/07/16 01:26:29
Seems fair, the feature is still behind a flag aft
| |
241 } | 248 } |
242 | 249 |
243 if (options->hidden.get()) | 250 if (options->hidden.get()) |
244 create_params.hidden = *options->hidden.get(); | 251 create_params.hidden = *options->hidden.get(); |
245 | 252 |
246 if (options->resizable.get()) | 253 if (options->resizable.get()) |
247 create_params.resizable = *options->resizable.get(); | 254 create_params.resizable = *options->resizable.get(); |
248 | 255 |
249 if (options->always_on_top.get()) { | 256 if (options->always_on_top.get()) { |
250 create_params.always_on_top = *options->always_on_top.get(); | 257 create_params.always_on_top = *options->always_on_top.get(); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 | 497 |
491 if (options.frame->as_frame_options->inactive_color.get()) { | 498 if (options.frame->as_frame_options->inactive_color.get()) { |
492 error_ = app_window_constants::kInactiveColorWithoutColor; | 499 error_ = app_window_constants::kInactiveColorWithoutColor; |
493 return false; | 500 return false; |
494 } | 501 } |
495 | 502 |
496 return true; | 503 return true; |
497 } | 504 } |
498 | 505 |
499 } // namespace extensions | 506 } // namespace extensions |
OLD | NEW |