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

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

Issue 12632004: Revert 186643 - Caused a 10% regression on SunSpider benchmark (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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/webstore_bindings.h" 5 #include "chrome/renderer/extensions/webstore_bindings.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/common/extensions/extension.h" 8 #include "chrome/common/extensions/extension.h"
9 #include "chrome/common/extensions/extension_messages.h" 9 #include "chrome/common/extensions/extension_messages.h"
10 #include "chrome/renderer/extensions/chrome_v8_context.h" 10 #include "chrome/renderer/extensions/chrome_v8_context.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // chrome.webstore.install() calls generate an install ID so that the install's 47 // chrome.webstore.install() calls generate an install ID so that the install's
48 // callbacks may be fired when the browser notifies us of install completion 48 // callbacks may be fired when the browser notifies us of install completion
49 // (successful or not) via OnInlineWebstoreInstallResponse. 49 // (successful or not) via OnInlineWebstoreInstallResponse.
50 int g_next_install_id = 0; 50 int g_next_install_id = 0;
51 51
52 } // anonymous namespace 52 } // anonymous namespace
53 53
54 WebstoreBindings::WebstoreBindings(Dispatcher* dispatcher, 54 WebstoreBindings::WebstoreBindings(Dispatcher* dispatcher,
55 ChromeV8Context* context) 55 ChromeV8Context* context)
56 : ChromeV8Extension(dispatcher, context->v8_context()), 56 : ChromeV8Extension(dispatcher),
57 ChromeV8ExtensionHandler(context) { 57 ChromeV8ExtensionHandler(context) {
58 RouteFunction("Install", 58 RouteFunction("Install",
59 base::Bind(&WebstoreBindings::Install, base::Unretained(this))); 59 base::Bind(&WebstoreBindings::Install, base::Unretained(this)));
60 } 60 }
61 61
62 v8::Handle<v8::Value> WebstoreBindings::Install( 62 v8::Handle<v8::Value> WebstoreBindings::Install(
63 const v8::Arguments& args) { 63 const v8::Arguments& args) {
64 WebFrame* frame = WebFrame::frameForContext(v8_context()); 64 WebFrame* frame = WebFrame::frameForCurrentContext();
65 if (!frame || !frame->view()) 65 if (!frame || !frame->view())
66 return v8::Undefined(); 66 return v8::Undefined();
67 67
68 content::RenderView* render_view = 68 content::RenderView* render_view =
69 content::RenderView::FromWebView(frame->view()); 69 content::RenderView::FromWebView(frame->view());
70 if (!render_view) 70 if (!render_view)
71 return v8::Undefined(); 71 return v8::Undefined();
72 72
73 std::string preferred_store_link_url; 73 std::string preferred_store_link_url;
74 if (!args[0]->IsUndefined()) { 74 if (!args[0]->IsUndefined()) {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 v8::Context::Scope context_scope(context_->v8_context()); 213 v8::Context::Scope context_scope(context_->v8_context());
214 v8::Handle<v8::Value> argv[3]; 214 v8::Handle<v8::Value> argv[3];
215 argv[0] = v8::Integer::New(install_id); 215 argv[0] = v8::Integer::New(install_id);
216 argv[1] = v8::Boolean::New(success); 216 argv[1] = v8::Boolean::New(success);
217 argv[2] = v8::String::New(error.c_str()); 217 argv[2] = v8::String::New(error.c_str());
218 context_->CallChromeHiddenMethod("webstore.onInstallResponse", 218 context_->CallChromeHiddenMethod("webstore.onInstallResponse",
219 arraysize(argv), argv, NULL); 219 arraysize(argv), argv, NULL);
220 } 220 }
221 221
222 } // namespace extensions 222 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/web_request_custom_bindings.cc ('k') | chrome/renderer/resources/extensions/apitest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698