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

Side by Side Diff: chrome/renderer/extensions/notifications_native_handler.cc

Issue 1854983002: [Extensions] Add more bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comment Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/extensions/notifications_native_handler.h" 5 #include "chrome/renderer/extensions/notifications_native_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/common/extensions/api/notifications/notification_style.h" 11 #include "chrome/common/extensions/api/notifications/notification_style.h"
12 #include "content/public/child/v8_value_converter.h" 12 #include "content/public/child/v8_value_converter.h"
13 #include "extensions/renderer/script_context.h" 13 #include "extensions/renderer/script_context.h"
14 #include "ui/base/layout.h" 14 #include "ui/base/layout.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 NotificationsNativeHandler::NotificationsNativeHandler(ScriptContext* context) 18 NotificationsNativeHandler::NotificationsNativeHandler(ScriptContext* context)
19 : ObjectBackedNativeHandler(context) { 19 : ObjectBackedNativeHandler(context) {
20 RouteFunction( 20 RouteFunction(
21 "GetNotificationImageSizes", 21 "GetNotificationImageSizes", "notifications",
22 base::Bind(&NotificationsNativeHandler::GetNotificationImageSizes, 22 base::Bind(&NotificationsNativeHandler::GetNotificationImageSizes,
23 base::Unretained(this))); 23 base::Unretained(this)));
24 } 24 }
25 25
26 void NotificationsNativeHandler::GetNotificationImageSizes( 26 void NotificationsNativeHandler::GetNotificationImageSizes(
27 const v8::FunctionCallbackInfo<v8::Value>& args) { 27 const v8::FunctionCallbackInfo<v8::Value>& args) {
28 NotificationBitmapSizes bitmap_sizes = GetNotificationBitmapSizes(); 28 NotificationBitmapSizes bitmap_sizes = GetNotificationBitmapSizes();
29 29
30 float scale_factor = 30 float scale_factor =
31 ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactors().back()); 31 ui::GetScaleForScaleFactor(ui::GetSupportedScaleFactors().back());
(...skipping 11 matching lines...) Expand all
43 dict->SetInteger("appIconMask.height", 43 dict->SetInteger("appIconMask.height",
44 bitmap_sizes.app_icon_mask_size.height()); 44 bitmap_sizes.app_icon_mask_size.height());
45 45
46 scoped_ptr<content::V8ValueConverter> converter( 46 scoped_ptr<content::V8ValueConverter> converter(
47 content::V8ValueConverter::create()); 47 content::V8ValueConverter::create());
48 args.GetReturnValue().Set( 48 args.GetReturnValue().Set(
49 converter->ToV8Value(dict.get(), context()->v8_context())); 49 converter->ToV8Value(dict.get(), context()->v8_context()));
50 } 50 }
51 51
52 } // namespace extensions 52 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698