| 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/macros.h" | 8 #include "base/macros.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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 "\"frame: 'none'\") or panel window (with \"type: panel\")."; | 73 "\"frame: 'none'\") or panel window (with \"type: panel\")."; |
| 74 #endif | 74 #endif |
| 75 } // namespace app_window_constants | 75 } // namespace app_window_constants |
| 76 | 76 |
| 77 const char kNoneFrameOption[] = "none"; | 77 const char kNoneFrameOption[] = "none"; |
| 78 | 78 |
| 79 namespace { | 79 namespace { |
| 80 | 80 |
| 81 // If the same property is specified for the inner and outer bounds, raise an | 81 // If the same property is specified for the inner and outer bounds, raise an |
| 82 // error. | 82 // error. |
| 83 bool CheckBoundsConflict(const scoped_ptr<int>& inner_property, | 83 bool CheckBoundsConflict(const std::unique_ptr<int>& inner_property, |
| 84 const scoped_ptr<int>& outer_property, | 84 const std::unique_ptr<int>& outer_property, |
| 85 const std::string& property_name, | 85 const std::string& property_name, |
| 86 std::string* error) { | 86 std::string* error) { |
| 87 if (inner_property.get() && outer_property.get()) { | 87 if (inner_property.get() && outer_property.get()) { |
| 88 std::vector<std::string> subst; | 88 std::vector<std::string> subst; |
| 89 subst.push_back(property_name); | 89 subst.push_back(property_name); |
| 90 *error = base::ReplaceStringPlaceholders( | 90 *error = base::ReplaceStringPlaceholders( |
| 91 app_window_constants::kConflictingBoundsOptions, subst, NULL); | 91 app_window_constants::kConflictingBoundsOptions, subst, NULL); |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 122 | 122 |
| 123 } // namespace | 123 } // namespace |
| 124 | 124 |
| 125 AppWindowCreateFunction::AppWindowCreateFunction() {} | 125 AppWindowCreateFunction::AppWindowCreateFunction() {} |
| 126 | 126 |
| 127 bool AppWindowCreateFunction::RunAsync() { | 127 bool AppWindowCreateFunction::RunAsync() { |
| 128 // Don't create app window if the system is shutting down. | 128 // Don't create app window if the system is shutting down. |
| 129 if (ExtensionsBrowserClient::Get()->IsShuttingDown()) | 129 if (ExtensionsBrowserClient::Get()->IsShuttingDown()) |
| 130 return false; | 130 return false; |
| 131 | 131 |
| 132 scoped_ptr<Create::Params> params(Create::Params::Create(*args_)); | 132 std::unique_ptr<Create::Params> params(Create::Params::Create(*args_)); |
| 133 EXTENSION_FUNCTION_VALIDATE(params.get()); | 133 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 134 | 134 |
| 135 GURL url = extension()->GetResourceURL(params->url); | 135 GURL url = extension()->GetResourceURL(params->url); |
| 136 // Allow absolute URLs for component apps, otherwise prepend the extension | 136 // Allow absolute URLs for component apps, otherwise prepend the extension |
| 137 // path. | 137 // path. |
| 138 // TODO(devlin): Investigate if this is still used. If not, kill it dead! | 138 // TODO(devlin): Investigate if this is still used. If not, kill it dead! |
| 139 GURL absolute = GURL(params->url); | 139 GURL absolute = GURL(params->url); |
| 140 if (absolute.has_scheme()) { | 140 if (absolute.has_scheme()) { |
| 141 if (extension()->location() == Manifest::COMPONENT) { | 141 if (extension()->location() == Manifest::COMPONENT) { |
| 142 url = absolute; | 142 url = absolute; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 if (options.frame->as_frame_options->inactive_color.get()) { | 550 if (options.frame->as_frame_options->inactive_color.get()) { |
| 551 error_ = app_window_constants::kInactiveColorWithoutColor; | 551 error_ = app_window_constants::kInactiveColorWithoutColor; |
| 552 return false; | 552 return false; |
| 553 } | 553 } |
| 554 | 554 |
| 555 return true; | 555 return true; |
| 556 } | 556 } |
| 557 | 557 |
| 558 } // namespace extensions | 558 } // namespace extensions |
| OLD | NEW |