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

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

Issue 227413008: Add the feature to retain the user gesture in the extension callback (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 6 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 | 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/renderer/extensions/extension_helper.h" 5 #include "chrome/renderer/extensions/extension_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // gets called for navigations within the document. 246 // gets called for navigations within the document.
247 if (g_schedulers.Get().count(frame)) 247 if (g_schedulers.Get().count(frame))
248 return; 248 return;
249 249
250 g_schedulers.Get()[frame] = new UserScriptScheduler(frame, dispatcher_); 250 g_schedulers.Get()[frame] = new UserScriptScheduler(frame, dispatcher_);
251 } 251 }
252 252
253 void ExtensionHelper::OnExtensionResponse(int request_id, 253 void ExtensionHelper::OnExtensionResponse(int request_id,
254 bool success, 254 bool success,
255 const base::ListValue& response, 255 const base::ListValue& response,
256 const std::string& error) { 256 const std::string& error,
257 const bool user_gesture) {
258 scoped_ptr<WebScopedUserGesture> gesture;
259 if (user_gesture)
260 gesture.reset(new WebScopedUserGesture);
261
257 dispatcher_->OnExtensionResponse(request_id, 262 dispatcher_->OnExtensionResponse(request_id,
258 success, 263 success,
259 response, 264 response,
260 error); 265 error);
261 } 266 }
262 267
263 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id, 268 void ExtensionHelper::OnExtensionMessageInvoke(const std::string& extension_id,
264 const std::string& module_name, 269 const std::string& module_name,
265 const std::string& function_name, 270 const std::string& function_name,
266 const base::ListValue& args, 271 const base::ListValue& args,
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); 375 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext();
371 ChromeV8Context* chrome_v8_context = 376 ChromeV8Context* chrome_v8_context =
372 dispatcher_->v8_context_set().GetByV8Context(script_context); 377 dispatcher_->v8_context_set().GetByV8Context(script_context);
373 if (!chrome_v8_context) 378 if (!chrome_v8_context)
374 return; 379 return;
375 chrome_v8_context->module_system()->CallModuleMethod( 380 chrome_v8_context->module_system()->CallModuleMethod(
376 "app.window", "onAppWindowClosed"); 381 "app.window", "onAppWindowClosed");
377 } 382 }
378 383
379 } // namespace extensions 384 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698