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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 "The window id can not be more than 256 characters long."; | 43 "The window id can not be more than 256 characters long."; |
44 const char kInvalidColorSpecification[] = | 44 const char kInvalidColorSpecification[] = |
45 "The color specification could not be parsed."; | 45 "The color specification could not be parsed."; |
46 const char kInvalidChannelForFrameOptions[] = | 46 const char kInvalidChannelForFrameOptions[] = |
47 "Frame options are only available in dev channel."; | 47 "Frame options are only available in dev channel."; |
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 | |
54 #if defined(USE_AURA) | |
55 const char kMissingPermissionAlphaEnabled[] = | |
56 "The alphaEnabled option requires app.window.alpha permission."; | |
57 #endif | |
53 } // namespace app_window_constants | 58 } // namespace app_window_constants |
54 | 59 |
55 const char kNoneFrameOption[] = "none"; | 60 const char kNoneFrameOption[] = "none"; |
56 // TODO(benwells): Remove HTML titlebar injection. | 61 // TODO(benwells): Remove HTML titlebar injection. |
57 const char kHtmlFrameOption[] = "experimental-html"; | 62 const char kHtmlFrameOption[] = "experimental-html"; |
58 | 63 |
59 namespace { | 64 namespace { |
60 | 65 |
61 // Opens an inspector window and delays the response to the | 66 // Opens an inspector window and delays the response to the |
62 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is | 67 // AppWindowCreateFunction until the DevToolsWindow has finished loading, and is |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV || | 221 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV || |
217 GetExtension()->location() == extensions::Manifest::COMPONENT) { | 222 GetExtension()->location() == extensions::Manifest::COMPONENT) { |
218 if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) { | 223 if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) { |
219 create_params.window_type = AppWindow::WINDOW_TYPE_PANEL; | 224 create_params.window_type = AppWindow::WINDOW_TYPE_PANEL; |
220 } | 225 } |
221 } | 226 } |
222 | 227 |
223 if (!GetFrameOptions(*options, &create_params)) | 228 if (!GetFrameOptions(*options, &create_params)) |
224 return false; | 229 return false; |
225 | 230 |
226 if (options->transparent_background.get() && | 231 #if defined(USE_AURA) |
benwells
2014/05/12 04:25:17
Why is this gated on aura? If you try to use this
garykac
2014/07/09 23:19:21
Done.
| |
227 (GetExtension()->HasAPIPermission(APIPermission::kExperimental) || | 232 if (options->alpha_enabled.get()) { |
228 CommandLine::ForCurrentProcess()->HasSwitch( | 233 bool allow_alpha_enabled = false; |
229 switches::kEnableExperimentalExtensionApis))) { | 234 // For now, continue to support this if Experimental is set (any channel). |
230 create_params.transparent_background = *options->transparent_background; | 235 // TODO(garykac) Remove this once the permission moves to stable. |
236 if (GetExtension()->HasAPIPermission(APIPermission::kExperimental) || | |
benwells
2014/05/12 04:25:17
After thinking about it I'd prefer to remove acces
garykac
2014/07/09 23:19:21
I don't know of any apps. Removed.
| |
237 CommandLine::ForCurrentProcess()->HasSwitch( | |
238 switches::kEnableExperimentalExtensionApis)) { | |
239 allow_alpha_enabled = true; | |
240 } | |
241 // Support alphaEnabled permission on dev channel. | |
242 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) { | |
benwells
2014/05/12 04:25:17
There should also be an error if the user tries to
garykac
2014/07/09 23:19:21
Done. Handled in the _permission_features.json.
| |
243 if (GetExtension()->HasAPIPermission(APIPermission::kAlphaEnabled)) { | |
244 allow_alpha_enabled = true; | |
245 } else { | |
246 error_ = app_window_constants::kMissingPermissionAlphaEnabled; | |
247 return false; | |
248 } | |
249 } | |
250 if (allow_alpha_enabled) { | |
251 create_params.alpha_enabled = *options->alpha_enabled; | |
252 } | |
231 } | 253 } |
254 #endif | |
232 | 255 |
233 if (options->hidden.get()) | 256 if (options->hidden.get()) |
234 create_params.hidden = *options->hidden.get(); | 257 create_params.hidden = *options->hidden.get(); |
235 | 258 |
236 if (options->resizable.get()) | 259 if (options->resizable.get()) |
237 create_params.resizable = *options->resizable.get(); | 260 create_params.resizable = *options->resizable.get(); |
238 | 261 |
239 if (options->always_on_top.get() && | 262 if (options->always_on_top.get() && |
240 GetExtension()->HasAPIPermission(APIPermission::kAlwaysOnTopWindows)) | 263 GetExtension()->HasAPIPermission(APIPermission::kAlwaysOnTopWindows)) |
241 create_params.always_on_top = *options->always_on_top.get(); | 264 create_params.always_on_top = *options->always_on_top.get(); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
492 // TODO(benwells): Remove this code once we get agreement to use the new | 515 // TODO(benwells): Remove this code once we get agreement to use the new |
493 // native style frame. | 516 // native style frame. |
494 create_params->has_frame_color = true; | 517 create_params->has_frame_color = true; |
495 create_params->active_frame_color = SK_ColorWHITE; | 518 create_params->active_frame_color = SK_ColorWHITE; |
496 create_params->inactive_frame_color = SK_ColorWHITE; | 519 create_params->inactive_frame_color = SK_ColorWHITE; |
497 } | 520 } |
498 #endif | 521 #endif |
499 } | 522 } |
500 | 523 |
501 } // namespace extensions | 524 } // namespace extensions |
OLD | NEW |