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

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

Issue 314113010: Remove deprecated permissions functions from Extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
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.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"
11 #include "apps/ui/native_app_window.h" 11 #include "apps/ui/native_app_window.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/devtools/devtools_window.h" 17 #include "chrome/browser/devtools/devtools_window.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/common/extensions/api/app_window.h" 19 #include "chrome/common/extensions/api/app_window.h"
20 #include "chrome/common/extensions/features/feature_channel.h" 20 #include "chrome/common/extensions/features/feature_channel.h"
21 #include "content/public/browser/notification_registrar.h" 21 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/render_view_host.h" 24 #include "content/public/browser/render_view_host.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/url_constants.h" 26 #include "content/public/common/url_constants.h"
27 #include "extensions/browser/extensions_browser_client.h" 27 #include "extensions/browser/extensions_browser_client.h"
28 #include "extensions/browser/image_util.h" 28 #include "extensions/browser/image_util.h"
29 #include "extensions/common/permissions/permissions_data.h"
29 #include "extensions/common/switches.h" 30 #include "extensions/common/switches.h"
30 #include "third_party/skia/include/core/SkColor.h" 31 #include "third_party/skia/include/core/SkColor.h"
31 #include "ui/base/ui_base_types.h" 32 #include "ui/base/ui_base_types.h"
32 #include "ui/gfx/rect.h" 33 #include "ui/gfx/rect.h"
33 #include "url/gurl.h" 34 #include "url/gurl.h"
34 35
35 using apps::AppWindow; 36 using apps::AppWindow;
36 37
37 namespace app_window = extensions::api::app_window; 38 namespace app_window = extensions::api::app_window;
38 namespace Create = app_window::Create; 39 namespace Create = app_window::Create;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 GetExtension()->location() == extensions::Manifest::COMPONENT) { 219 GetExtension()->location() == extensions::Manifest::COMPONENT) {
219 if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) { 220 if (options->type == extensions::api::app_window::WINDOW_TYPE_PANEL) {
220 create_params.window_type = AppWindow::WINDOW_TYPE_PANEL; 221 create_params.window_type = AppWindow::WINDOW_TYPE_PANEL;
221 } 222 }
222 } 223 }
223 224
224 if (!GetFrameOptions(*options, &create_params)) 225 if (!GetFrameOptions(*options, &create_params))
225 return false; 226 return false;
226 227
227 if (options->transparent_background.get() && 228 if (options->transparent_background.get() &&
228 (GetExtension()->HasAPIPermission(APIPermission::kExperimental) || 229 (GetExtension()->permissions_data()->HasAPIPermission(
230 APIPermission::kExperimental) ||
229 CommandLine::ForCurrentProcess()->HasSwitch( 231 CommandLine::ForCurrentProcess()->HasSwitch(
230 switches::kEnableExperimentalExtensionApis))) { 232 switches::kEnableExperimentalExtensionApis))) {
231 create_params.transparent_background = *options->transparent_background; 233 create_params.transparent_background = *options->transparent_background;
232 } 234 }
233 235
234 if (options->hidden.get()) 236 if (options->hidden.get())
235 create_params.hidden = *options->hidden.get(); 237 create_params.hidden = *options->hidden.get();
236 238
237 if (options->resizable.get()) 239 if (options->resizable.get())
238 create_params.resizable = *options->resizable.get(); 240 create_params.resizable = *options->resizable.get();
239 241
240 if (options->always_on_top.get()) { 242 if (options->always_on_top.get()) {
241 create_params.always_on_top = *options->always_on_top.get(); 243 create_params.always_on_top = *options->always_on_top.get();
242 244
243 if (create_params.always_on_top && !GetExtension()->HasAPIPermission( 245 if (create_params.always_on_top &&
246 !GetExtension()->permissions_data()->HasAPIPermission(
244 APIPermission::kAlwaysOnTopWindows)) { 247 APIPermission::kAlwaysOnTopWindows)) {
245 error_ = app_window_constants::kAlwaysOnTopPermission; 248 error_ = app_window_constants::kAlwaysOnTopPermission;
246 return false; 249 return false;
247 } 250 }
248 } 251 }
249 252
250 if (options->focused.get()) 253 if (options->focused.get())
251 create_params.focused = *options->focused.get(); 254 create_params.focused = *options->focused.get();
252 255
253 if (options->type != extensions::api::app_window::WINDOW_TYPE_PANEL) { 256 if (options->type != extensions::api::app_window::WINDOW_TYPE_PANEL) {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 maximum_size.set_width(*options.max_width); 415 maximum_size.set_width(*options.max_width);
413 if (options.max_height.get()) 416 if (options.max_height.get())
414 maximum_size.set_height(*options.max_height); 417 maximum_size.set_height(*options.max_height);
415 } 418 }
416 419
417 return true; 420 return true;
418 } 421 }
419 422
420 AppWindow::Frame AppWindowCreateFunction::GetFrameFromString( 423 AppWindow::Frame AppWindowCreateFunction::GetFrameFromString(
421 const std::string& frame_string) { 424 const std::string& frame_string) {
422 if (frame_string == kHtmlFrameOption && 425 if (frame_string == kHtmlFrameOption &&
423 (GetExtension()->HasAPIPermission(APIPermission::kExperimental) || 426 (GetExtension()->permissions_data()->HasAPIPermission(
424 CommandLine::ForCurrentProcess()->HasSwitch( 427 APIPermission::kExperimental) ||
425 switches::kEnableExperimentalExtensionApis))) { 428 CommandLine::ForCurrentProcess()->HasSwitch(
429 switches::kEnableExperimentalExtensionApis))) {
426 inject_html_titlebar_ = true; 430 inject_html_titlebar_ = true;
427 return AppWindow::FRAME_NONE; 431 return AppWindow::FRAME_NONE;
428 } 432 }
429 433
430 if (frame_string == kNoneFrameOption) 434 if (frame_string == kNoneFrameOption)
431 return AppWindow::FRAME_NONE; 435 return AppWindow::FRAME_NONE;
432 436
433 return AppWindow::FRAME_CHROME; 437 return AppWindow::FRAME_CHROME;
434 } 438 }
435 439
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 483
480 if (options.frame->as_frame_options->inactive_color.get()) { 484 if (options.frame->as_frame_options->inactive_color.get()) {
481 error_ = app_window_constants::kInactiveColorWithoutColor; 485 error_ = app_window_constants::kInactiveColorWithoutColor;
482 return false; 486 return false;
483 } 487 }
484 488
485 return true; 489 return true;
486 } 490 }
487 491
488 } // namespace extensions 492 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698