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

Side by Side Diff: extensions/renderer/lazy_background_page_native_handler.cc

Issue 1866103002: [Extensions] Expand bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 "extensions/renderer/lazy_background_page_native_handler.h" 5 #include "extensions/renderer/lazy_background_page_native_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/public/renderer/render_frame.h" 8 #include "content/public/renderer/render_frame.h"
9 #include "extensions/common/extension_messages.h" 9 #include "extensions/common/extension_messages.h"
10 #include "extensions/renderer/extension_frame_helper.h" 10 #include "extensions/renderer/extension_frame_helper.h"
11 #include "extensions/renderer/script_context.h" 11 #include "extensions/renderer/script_context.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 LazyBackgroundPageNativeHandler::LazyBackgroundPageNativeHandler( 15 LazyBackgroundPageNativeHandler::LazyBackgroundPageNativeHandler(
16 ScriptContext* context) 16 ScriptContext* context)
17 : ObjectBackedNativeHandler(context) { 17 : ObjectBackedNativeHandler(context) {
18 RouteFunction( 18 RouteFunction(
19 "IncrementKeepaliveCount", 19 "IncrementKeepaliveCount", "tts",
20 base::Bind(&LazyBackgroundPageNativeHandler::IncrementKeepaliveCount, 20 base::Bind(&LazyBackgroundPageNativeHandler::IncrementKeepaliveCount,
21 base::Unretained(this))); 21 base::Unretained(this)));
22 RouteFunction( 22 RouteFunction(
23 "DecrementKeepaliveCount", 23 "DecrementKeepaliveCount", "tts",
24 base::Bind(&LazyBackgroundPageNativeHandler::DecrementKeepaliveCount, 24 base::Bind(&LazyBackgroundPageNativeHandler::DecrementKeepaliveCount,
25 base::Unretained(this))); 25 base::Unretained(this)));
26 } 26 }
27 27
28 void LazyBackgroundPageNativeHandler::IncrementKeepaliveCount( 28 void LazyBackgroundPageNativeHandler::IncrementKeepaliveCount(
29 const v8::FunctionCallbackInfo<v8::Value>& args) { 29 const v8::FunctionCallbackInfo<v8::Value>& args) {
30 if (context() && ExtensionFrameHelper::IsContextForEventPage(context())) { 30 if (context() && ExtensionFrameHelper::IsContextForEventPage(context())) {
31 content::RenderFrame* render_frame = context()->GetRenderFrame(); 31 content::RenderFrame* render_frame = context()->GetRenderFrame();
32 render_frame->Send(new ExtensionHostMsg_IncrementLazyKeepaliveCount( 32 render_frame->Send(new ExtensionHostMsg_IncrementLazyKeepaliveCount(
33 render_frame->GetRoutingID())); 33 render_frame->GetRoutingID()));
34 } 34 }
35 } 35 }
36 36
37 void LazyBackgroundPageNativeHandler::DecrementKeepaliveCount( 37 void LazyBackgroundPageNativeHandler::DecrementKeepaliveCount(
38 const v8::FunctionCallbackInfo<v8::Value>& args) { 38 const v8::FunctionCallbackInfo<v8::Value>& args) {
39 if (context() && ExtensionFrameHelper::IsContextForEventPage(context())) { 39 if (context() && ExtensionFrameHelper::IsContextForEventPage(context())) {
40 content::RenderFrame* render_frame = context()->GetRenderFrame(); 40 content::RenderFrame* render_frame = context()->GetRenderFrame();
41 render_frame->Send(new ExtensionHostMsg_DecrementLazyKeepaliveCount( 41 render_frame->Send(new ExtensionHostMsg_DecrementLazyKeepaliveCount(
42 render_frame->GetRoutingID())); 42 render_frame->GetRoutingID()));
43 } 43 }
44 } 44 }
45 45
46 } // namespace extensions 46 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698