Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chrome/browser/extensions/api/app_window/app_window_api.cc

Issue 53973003: Deprecate 'singleton' option in chrome.apps.window.create(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/api/app_window.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/app_window.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698