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 "extensions/browser/api/app_window/app_window_api.h" | 5 #include "extensions/browser/api/app_window/app_window_api.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 !extension()->permissions_data()->HasAPIPermission( | 254 !extension()->permissions_data()->HasAPIPermission( |
253 APIPermission::kAlwaysOnTopWindows)) { | 255 APIPermission::kAlwaysOnTopWindows)) { |
254 error_ = app_window_constants::kAlwaysOnTopPermission; | 256 error_ = app_window_constants::kAlwaysOnTopPermission; |
255 return false; | 257 return false; |
256 } | 258 } |
257 } | 259 } |
258 | 260 |
259 if (options->focused.get()) | 261 if (options->focused.get()) |
260 create_params.focused = *options->focused.get(); | 262 create_params.focused = *options->focused.get(); |
261 | 263 |
| 264 if (options->visible_on_all_workspaces.get()) { |
| 265 if (AppsClient::Get()->IsCurrentChannelOlderThanDev()) { |
| 266 error_ = app_window_constants::kVisibleOnAllWorkspacesWrongChannel; |
| 267 return false; |
| 268 } |
| 269 create_params.visible_on_all_workspaces = |
| 270 *options->visible_on_all_workspaces.get(); |
| 271 } |
| 272 |
262 if (options->type != app_window::WINDOW_TYPE_PANEL) { | 273 if (options->type != app_window::WINDOW_TYPE_PANEL) { |
263 switch (options->state) { | 274 switch (options->state) { |
264 case app_window::STATE_NONE: | 275 case app_window::STATE_NONE: |
265 case app_window::STATE_NORMAL: | 276 case app_window::STATE_NORMAL: |
266 break; | 277 break; |
267 case app_window::STATE_FULLSCREEN: | 278 case app_window::STATE_FULLSCREEN: |
268 create_params.state = ui::SHOW_STATE_FULLSCREEN; | 279 create_params.state = ui::SHOW_STATE_FULLSCREEN; |
269 break; | 280 break; |
270 case app_window::STATE_MAXIMIZED: | 281 case app_window::STATE_MAXIMIZED: |
271 create_params.state = ui::SHOW_STATE_MAXIMIZED; | 282 create_params.state = ui::SHOW_STATE_MAXIMIZED; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 501 |
491 if (options.frame->as_frame_options->inactive_color.get()) { | 502 if (options.frame->as_frame_options->inactive_color.get()) { |
492 error_ = app_window_constants::kInactiveColorWithoutColor; | 503 error_ = app_window_constants::kInactiveColorWithoutColor; |
493 return false; | 504 return false; |
494 } | 505 } |
495 | 506 |
496 return true; | 507 return true; |
497 } | 508 } |
498 | 509 |
499 } // namespace extensions | 510 } // namespace extensions |
OLD | NEW |