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."; | |
61 } // namespace app_window_constants | 59 } // namespace app_window_constants |
62 | 60 |
63 const char kNoneFrameOption[] = "none"; | 61 const char kNoneFrameOption[] = "none"; |
64 // TODO(benwells): Remove HTML titlebar injection. | 62 // TODO(benwells): Remove HTML titlebar injection. |
65 const char kHtmlFrameOption[] = "experimental-html"; | 63 const char kHtmlFrameOption[] = "experimental-html"; |
66 | 64 |
67 namespace { | 65 namespace { |
68 | 66 |
69 // If the same property is specified for the inner and outer bounds, raise an | 67 // If the same property is specified for the inner and outer bounds, raise an |
70 // error. | 68 // error. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 !extension()->permissions_data()->HasAPIPermission( | 252 !extension()->permissions_data()->HasAPIPermission( |
255 APIPermission::kAlwaysOnTopWindows)) { | 253 APIPermission::kAlwaysOnTopWindows)) { |
256 error_ = app_window_constants::kAlwaysOnTopPermission; | 254 error_ = app_window_constants::kAlwaysOnTopPermission; |
257 return false; | 255 return false; |
258 } | 256 } |
259 } | 257 } |
260 | 258 |
261 if (options->focused.get()) | 259 if (options->focused.get()) |
262 create_params.focused = *options->focused.get(); | 260 create_params.focused = *options->focused.get(); |
263 | 261 |
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 | |
273 if (options->type != app_window::WINDOW_TYPE_PANEL) { | 262 if (options->type != app_window::WINDOW_TYPE_PANEL) { |
274 switch (options->state) { | 263 switch (options->state) { |
275 case app_window::STATE_NONE: | 264 case app_window::STATE_NONE: |
276 case app_window::STATE_NORMAL: | 265 case app_window::STATE_NORMAL: |
277 break; | 266 break; |
278 case app_window::STATE_FULLSCREEN: | 267 case app_window::STATE_FULLSCREEN: |
279 create_params.state = ui::SHOW_STATE_FULLSCREEN; | 268 create_params.state = ui::SHOW_STATE_FULLSCREEN; |
280 break; | 269 break; |
281 case app_window::STATE_MAXIMIZED: | 270 case app_window::STATE_MAXIMIZED: |
282 create_params.state = ui::SHOW_STATE_MAXIMIZED; | 271 create_params.state = ui::SHOW_STATE_MAXIMIZED; |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 490 |
502 if (options.frame->as_frame_options->inactive_color.get()) { | 491 if (options.frame->as_frame_options->inactive_color.get()) { |
503 error_ = app_window_constants::kInactiveColorWithoutColor; | 492 error_ = app_window_constants::kInactiveColorWithoutColor; |
504 return false; | 493 return false; |
505 } | 494 } |
506 | 495 |
507 return true; | 496 return true; |
508 } | 497 } |
509 | 498 |
510 } // namespace extensions | 499 } // namespace extensions |
OLD | NEW |