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_contents.h" | 7 #include "apps/app_window_contents.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 const char kAlwaysOnTopPermission[] = | 49 const char kAlwaysOnTopPermission[] = |
50 "The \"app.window.alwaysOnTop\" permission is required."; | 50 "The \"app.window.alwaysOnTop\" permission is required."; |
51 const char kInvalidUrlParameter[] = | 51 const char kInvalidUrlParameter[] = |
52 "The URL used for window creation must be local for security reasons."; | 52 "The URL used for window creation must be local for security reasons."; |
53 const char kAlphaEnabledWrongChannel[] = | 53 const char kAlphaEnabledWrongChannel[] = |
54 "The alphaEnabled option requires dev channel or newer."; | 54 "The alphaEnabled option requires dev channel or newer."; |
55 const char kAlphaEnabledMissingPermission[] = | 55 const char kAlphaEnabledMissingPermission[] = |
56 "The alphaEnabled option requires app.window.alpha permission."; | 56 "The alphaEnabled option requires app.window.alpha permission."; |
57 const char kAlphaEnabledNeedsFrameNone[] = | 57 const char kAlphaEnabledNeedsFrameNone[] = |
58 "The alphaEnabled option can only be used with \"frame: 'none'\"."; | 58 "The alphaEnabled option can only be used with \"frame: 'none'\"."; |
| 59 const char kVisibleOnAllWorkspacesWrongChannel[] = |
| 60 "The visibleOnAllWorkspaces option requires dev channel or newer."; |
59 } // namespace app_window_constants | 61 } // namespace app_window_constants |
60 | 62 |
61 const char kNoneFrameOption[] = "none"; | 63 const char kNoneFrameOption[] = "none"; |
62 // TODO(benwells): Remove HTML titlebar injection. | 64 // TODO(benwells): Remove HTML titlebar injection. |
63 const char kHtmlFrameOption[] = "experimental-html"; | 65 const char kHtmlFrameOption[] = "experimental-html"; |
64 | 66 |
65 namespace { | 67 namespace { |
66 | 68 |
67 // If the same property is specified for the inner and outer bounds, raise an | 69 // If the same property is specified for the inner and outer bounds, raise an |
68 // error. | 70 // error. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 !extension()->permissions_data()->HasAPIPermission( | 252 !extension()->permissions_data()->HasAPIPermission( |
251 APIPermission::kAlwaysOnTopWindows)) { | 253 APIPermission::kAlwaysOnTopWindows)) { |
252 error_ = app_window_constants::kAlwaysOnTopPermission; | 254 error_ = app_window_constants::kAlwaysOnTopPermission; |
253 return false; | 255 return false; |
254 } | 256 } |
255 } | 257 } |
256 | 258 |
257 if (options->focused.get()) | 259 if (options->focused.get()) |
258 create_params.focused = *options->focused.get(); | 260 create_params.focused = *options->focused.get(); |
259 | 261 |
| 262 if (options->visible_on_all_workspaces.get()) { |
| 263 if (AppsClient::Get()->IsCurrentChannelOlderThanDev()) { |
| 264 error_ = app_window_constants::kVisibleOnAllWorkspacesWrongChannel; |
| 265 return false; |
| 266 } |
| 267 create_params.visible_on_all_workspaces = |
| 268 *options->visible_on_all_workspaces.get(); |
| 269 } |
| 270 |
260 if (options->type != extensions::api::app_window::WINDOW_TYPE_PANEL) { | 271 if (options->type != extensions::api::app_window::WINDOW_TYPE_PANEL) { |
261 switch (options->state) { | 272 switch (options->state) { |
262 case extensions::api::app_window::STATE_NONE: | 273 case extensions::api::app_window::STATE_NONE: |
263 case extensions::api::app_window::STATE_NORMAL: | 274 case extensions::api::app_window::STATE_NORMAL: |
264 break; | 275 break; |
265 case extensions::api::app_window::STATE_FULLSCREEN: | 276 case extensions::api::app_window::STATE_FULLSCREEN: |
266 create_params.state = ui::SHOW_STATE_FULLSCREEN; | 277 create_params.state = ui::SHOW_STATE_FULLSCREEN; |
267 break; | 278 break; |
268 case extensions::api::app_window::STATE_MAXIMIZED: | 279 case extensions::api::app_window::STATE_MAXIMIZED: |
269 create_params.state = ui::SHOW_STATE_MAXIMIZED; | 280 create_params.state = ui::SHOW_STATE_MAXIMIZED; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 500 |
490 if (options.frame->as_frame_options->inactive_color.get()) { | 501 if (options.frame->as_frame_options->inactive_color.get()) { |
491 error_ = app_window_constants::kInactiveColorWithoutColor; | 502 error_ = app_window_constants::kInactiveColorWithoutColor; |
492 return false; | 503 return false; |
493 } | 504 } |
494 | 505 |
495 return true; | 506 return true; |
496 } | 507 } |
497 | 508 |
498 } // namespace extensions | 509 } // namespace extensions |
OLD | NEW |