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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 const char kAlwaysOnTopPermission[] = | 50 const char kAlwaysOnTopPermission[] = |
51 "The \"app.window.alwaysOnTop\" permission is required."; | 51 "The \"app.window.alwaysOnTop\" permission is required."; |
52 const char kInvalidUrlParameter[] = | 52 const char kInvalidUrlParameter[] = |
53 "The URL used for window creation must be local for security reasons."; | 53 "The URL used for window creation must be local for security reasons."; |
54 const char kAlphaEnabledWrongChannel[] = | 54 const char kAlphaEnabledWrongChannel[] = |
55 "The alphaEnabled option requires dev channel or newer."; | 55 "The alphaEnabled option requires dev channel or newer."; |
56 const char kAlphaEnabledMissingPermission[] = | 56 const char kAlphaEnabledMissingPermission[] = |
57 "The alphaEnabled option requires app.window.alpha permission."; | 57 "The alphaEnabled option requires app.window.alpha permission."; |
58 const char kAlphaEnabledNeedsFrameNone[] = | 58 const char kAlphaEnabledNeedsFrameNone[] = |
59 "The alphaEnabled option can only be used with \"frame: 'none'\"."; | 59 "The alphaEnabled option can only be used with \"frame: 'none'\"."; |
60 const char kVisibleOnAllWorkspacesWrongChannel[] = | |
61 "The visibleOnAllWorkspaces option requires dev channel or newer."; | |
62 const char kImeWindowMissingPermission[] = | 60 const char kImeWindowMissingPermission[] = |
63 "Extensions require the \"app.window.ime\" permission to create windows."; | 61 "Extensions require the \"app.window.ime\" permission to create windows."; |
64 const char kImeOptionIsNotSupported[] = | 62 const char kImeOptionIsNotSupported[] = |
65 "The \"ime\" option is not supported for platform app."; | 63 "The \"ime\" option is not supported for platform app."; |
66 #if !defined(OS_CHROMEOS) | 64 #if !defined(OS_CHROMEOS) |
67 const char kImeWindowUnsupportedPlatform[] = | 65 const char kImeWindowUnsupportedPlatform[] = |
68 "The \"ime\" option can only be used on ChromeOS."; | 66 "The \"ime\" option can only be used on ChromeOS."; |
69 #else | 67 #else |
70 const char kImeOptionMustBeTrueAndNeedsFrameNone[] = | 68 const char kImeOptionMustBeTrueAndNeedsFrameNone[] = |
71 "IME extensions must create window with \"ime: true\" and " | 69 "IME extensions must create window with \"ime: true\" and " |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 APIPermission::kAlwaysOnTopWindows)) { | 301 APIPermission::kAlwaysOnTopWindows)) { |
304 error_ = app_window_constants::kAlwaysOnTopPermission; | 302 error_ = app_window_constants::kAlwaysOnTopPermission; |
305 return false; | 303 return false; |
306 } | 304 } |
307 } | 305 } |
308 | 306 |
309 if (options->focused.get()) | 307 if (options->focused.get()) |
310 create_params.focused = *options->focused.get(); | 308 create_params.focused = *options->focused.get(); |
311 | 309 |
312 if (options->visible_on_all_workspaces.get()) { | 310 if (options->visible_on_all_workspaces.get()) { |
313 if (AppWindowClient::Get()->IsCurrentChannelOlderThanDev()) { | |
314 error_ = app_window_constants::kVisibleOnAllWorkspacesWrongChannel; | |
315 return false; | |
316 } | |
317 create_params.visible_on_all_workspaces = | 311 create_params.visible_on_all_workspaces = |
318 *options->visible_on_all_workspaces.get(); | 312 *options->visible_on_all_workspaces.get(); |
319 } | 313 } |
320 | 314 |
321 if (options->type != app_window::WINDOW_TYPE_PANEL) { | 315 if (options->type != app_window::WINDOW_TYPE_PANEL) { |
322 switch (options->state) { | 316 switch (options->state) { |
323 case app_window::STATE_NONE: | 317 case app_window::STATE_NONE: |
324 case app_window::STATE_NORMAL: | 318 case app_window::STATE_NORMAL: |
325 break; | 319 break; |
326 case app_window::STATE_FULLSCREEN: | 320 case app_window::STATE_FULLSCREEN: |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 | 543 |
550 if (options.frame->as_frame_options->inactive_color.get()) { | 544 if (options.frame->as_frame_options->inactive_color.get()) { |
551 error_ = app_window_constants::kInactiveColorWithoutColor; | 545 error_ = app_window_constants::kInactiveColorWithoutColor; |
552 return false; | 546 return false; |
553 } | 547 } |
554 | 548 |
555 return true; | 549 return true; |
556 } | 550 } |
557 | 551 |
558 } // namespace extensions | 552 } // namespace extensions |
OLD | NEW |