Chromium Code Reviews| 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 "chrome/browser/extensions/api/app_window/app_window_api.h" | 5 #include "chrome/browser/extensions/api/app_window/app_window_api.h" |
| 6 | 6 |
| 7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/app_window_contents.h" | 8 #include "apps/app_window_contents.h" |
| 9 #include "apps/app_window_registry.h" | 9 #include "apps/app_window_registry.h" |
| 10 #include "apps/apps_client.h" | 10 #include "apps/apps_client.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 | 151 |
| 152 GURL url = GetExtension()->GetResourceURL(params->url); | 152 GURL url = GetExtension()->GetResourceURL(params->url); |
| 153 // Allow absolute URLs for component apps, otherwise prepend the extension | 153 // Allow absolute URLs for component apps, otherwise prepend the extension |
| 154 // path. | 154 // path. |
| 155 if (GetExtension()->location() == extensions::Manifest::COMPONENT) { | 155 if (GetExtension()->location() == extensions::Manifest::COMPONENT) { |
| 156 GURL absolute = GURL(params->url); | 156 GURL absolute = GURL(params->url); |
| 157 if (absolute.has_scheme()) | 157 if (absolute.has_scheme()) |
| 158 url = absolute; | 158 url = absolute; |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Show warning when url passed isn't local | |
| 162 if (GURL(params->url).has_scheme()) { | |
| 163 WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_WARNING, | |
|
benwells
2014/06/18 03:22:17
Errors from APIs are generally communicated via ch
Nikhil
2014/06/18 08:52:39
Done.
| |
| 164 "Url passed as parameter to chrome.app.window.create() " | |
| 165 "should be local for security reasons."); | |
| 166 } | |
| 167 | |
| 161 // TODO(jeremya): figure out a way to pass the opening WebContents through to | 168 // TODO(jeremya): figure out a way to pass the opening WebContents through to |
| 162 // AppWindow::Create so we can set the opener at create time rather than | 169 // AppWindow::Create so we can set the opener at create time rather than |
| 163 // with a hack in AppWindowCustomBindings::GetView(). | 170 // with a hack in AppWindowCustomBindings::GetView(). |
| 164 AppWindow::CreateParams create_params; | 171 AppWindow::CreateParams create_params; |
| 165 app_window::CreateWindowOptions* options = params->options.get(); | 172 app_window::CreateWindowOptions* options = params->options.get(); |
| 166 if (options) { | 173 if (options) { |
| 167 if (options->id.get()) { | 174 if (options->id.get()) { |
| 168 // TODO(mek): use URL if no id specified? | 175 // TODO(mek): use URL if no id specified? |
| 169 // Limit length of id to 256 characters. | 176 // Limit length of id to 256 characters. |
| 170 if (options->id->length() > 256) { | 177 if (options->id->length() > 256) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 | 490 |
| 484 if (options.frame->as_frame_options->inactive_color.get()) { | 491 if (options.frame->as_frame_options->inactive_color.get()) { |
| 485 error_ = app_window_constants::kInactiveColorWithoutColor; | 492 error_ = app_window_constants::kInactiveColorWithoutColor; |
| 486 return false; | 493 return false; |
| 487 } | 494 } |
| 488 | 495 |
| 489 return true; | 496 return true; |
| 490 } | 497 } |
| 491 | 498 |
| 492 } // namespace extensions | 499 } // namespace extensions |
| OLD | NEW |