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_contents.h" | 7 #include "apps/app_window_contents.h" |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
10 #include "apps/ui/native_app_window.h" | 10 #include "apps/ui/native_app_window.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (options->id.get()) { | 152 if (options->id.get()) { |
153 // TODO(mek): use URL if no id specified? | 153 // TODO(mek): use URL if no id specified? |
154 // Limit length of id to 256 characters. | 154 // Limit length of id to 256 characters. |
155 if (options->id->length() > 256) { | 155 if (options->id->length() > 256) { |
156 error_ = app_window_constants::kInvalidWindowId; | 156 error_ = app_window_constants::kInvalidWindowId; |
157 return false; | 157 return false; |
158 } | 158 } |
159 | 159 |
160 create_params.window_key = *options->id; | 160 create_params.window_key = *options->id; |
161 | 161 |
| 162 if (options->singleton && *options->singleton == false) { |
| 163 WriteToConsole( |
| 164 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 165 "The 'singleton' option in chrome.apps.window.create() is deprecated!" |
| 166 " Change your code to no longer rely on this."); |
| 167 } |
| 168 |
162 if (!options->singleton || *options->singleton) { | 169 if (!options->singleton || *options->singleton) { |
163 ShellWindow* window = apps::ShellWindowRegistry::Get( | 170 ShellWindow* window = apps::ShellWindowRegistry::Get( |
164 GetProfile())->GetShellWindowForAppAndKey(extension_id(), | 171 GetProfile())->GetShellWindowForAppAndKey(extension_id(), |
165 create_params.window_key); | 172 create_params.window_key); |
166 if (window) { | 173 if (window) { |
167 content::RenderViewHost* created_view = | 174 content::RenderViewHost* created_view = |
168 window->web_contents()->GetRenderViewHost(); | 175 window->web_contents()->GetRenderViewHost(); |
169 int view_id = MSG_ROUTING_NONE; | 176 int view_id = MSG_ROUTING_NONE; |
170 if (render_view_host_->GetProcess()->GetID() == | 177 if (render_view_host_->GetProcess()->GetID() == |
171 created_view->GetProcess()->GetID()) { | 178 created_view->GetProcess()->GetID()) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 ->HadDevToolsAttached(created_view)) { | 320 ->HadDevToolsAttached(created_view)) { |
314 new DevToolsRestorer(this, created_view); | 321 new DevToolsRestorer(this, created_view); |
315 return true; | 322 return true; |
316 } | 323 } |
317 | 324 |
318 SendResponse(true); | 325 SendResponse(true); |
319 return true; | 326 return true; |
320 } | 327 } |
321 | 328 |
322 } // namespace extensions | 329 } // namespace extensions |
OLD | NEW |