| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 const char kImeOptionIsNotSupported[] = | 68 const char kImeOptionIsNotSupported[] = |
| 69 "The \"ime\" option is not supported for platform app."; | 69 "The \"ime\" option is not supported for platform app."; |
| 70 #if !defined(OS_CHROMEOS) | 70 #if !defined(OS_CHROMEOS) |
| 71 const char kImeWindowUnsupportedPlatform[] = | 71 const char kImeWindowUnsupportedPlatform[] = |
| 72 "The \"ime\" option can only be used on ChromeOS."; | 72 "The \"ime\" option can only be used on ChromeOS."; |
| 73 #else | 73 #else |
| 74 const char kImeWindowMustBeImeWindowOrPanel[] = | 74 const char kImeWindowMustBeImeWindowOrPanel[] = |
| 75 "IME extensions must create ime window ( with \"ime: true\" and " | 75 "IME extensions must create ime window ( with \"ime: true\" and " |
| 76 "\"frame: 'none'\") or panel window (with \"type: panel\")."; | 76 "\"frame: 'none'\") or panel window (with \"type: panel\")."; |
| 77 #endif | 77 #endif |
| 78 const char kShowInShelfWindowKeyNotSet[] = |
| 79 "The \"showInShelf\" option requires the \"id\" option to be set."; |
| 78 } // namespace app_window_constants | 80 } // namespace app_window_constants |
| 79 | 81 |
| 80 const char kNoneFrameOption[] = "none"; | 82 const char kNoneFrameOption[] = "none"; |
| 81 | 83 |
| 82 namespace { | 84 namespace { |
| 83 | 85 |
| 84 // If the same property is specified for the inner and outer bounds, raise an | 86 // If the same property is specified for the inner and outer bounds, raise an |
| 85 // error. | 87 // error. |
| 86 bool CheckBoundsConflict(const std::unique_ptr<int>& inner_property, | 88 bool CheckBoundsConflict(const std::unique_ptr<int>& inner_property, |
| 87 const std::unique_ptr<int>& outer_property, | 89 const std::unique_ptr<int>& outer_property, |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 316 } |
| 315 | 317 |
| 316 if (options->focused.get()) | 318 if (options->focused.get()) |
| 317 create_params.focused = *options->focused.get(); | 319 create_params.focused = *options->focused.get(); |
| 318 | 320 |
| 319 if (options->visible_on_all_workspaces.get()) { | 321 if (options->visible_on_all_workspaces.get()) { |
| 320 create_params.visible_on_all_workspaces = | 322 create_params.visible_on_all_workspaces = |
| 321 *options->visible_on_all_workspaces.get(); | 323 *options->visible_on_all_workspaces.get(); |
| 322 } | 324 } |
| 323 | 325 |
| 326 if (options->show_in_shelf.get()) { |
| 327 create_params.show_in_shelf = *options->show_in_shelf.get(); |
| 328 |
| 329 if (create_params.show_in_shelf && |
| 330 create_params.window_key.empty()) { |
| 331 error_ = app_window_constants::kShowInShelfWindowKeyNotSet; |
| 332 return false; |
| 333 } |
| 334 } |
| 335 |
| 324 if (options->type != app_window::WINDOW_TYPE_PANEL) { | 336 if (options->type != app_window::WINDOW_TYPE_PANEL) { |
| 325 switch (options->state) { | 337 switch (options->state) { |
| 326 case app_window::STATE_NONE: | 338 case app_window::STATE_NONE: |
| 327 case app_window::STATE_NORMAL: | 339 case app_window::STATE_NORMAL: |
| 328 break; | 340 break; |
| 329 case app_window::STATE_FULLSCREEN: | 341 case app_window::STATE_FULLSCREEN: |
| 330 create_params.state = ui::SHOW_STATE_FULLSCREEN; | 342 create_params.state = ui::SHOW_STATE_FULLSCREEN; |
| 331 break; | 343 break; |
| 332 case app_window::STATE_MAXIMIZED: | 344 case app_window::STATE_MAXIMIZED: |
| 333 create_params.state = ui::SHOW_STATE_MAXIMIZED; | 345 create_params.state = ui::SHOW_STATE_MAXIMIZED; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 565 |
| 554 if (options.frame->as_frame_options->inactive_color.get()) { | 566 if (options.frame->as_frame_options->inactive_color.get()) { |
| 555 error_ = app_window_constants::kInactiveColorWithoutColor; | 567 error_ = app_window_constants::kInactiveColorWithoutColor; |
| 556 return false; | 568 return false; |
| 557 } | 569 } |
| 558 | 570 |
| 559 return true; | 571 return true; |
| 560 } | 572 } |
| 561 | 573 |
| 562 } // namespace extensions | 574 } // namespace extensions |
| OLD | NEW |