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

Side by Side Diff: chrome/renderer/external_extension.cc

Issue 2072613003: Convert GetSearchProviderInstallState to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small twiddles Created 4 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
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/external_extension.h" 5 #include "chrome/renderer/external_extension.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/common/render_messages.h" 10 #include "chrome/common/render_messages.h"
11 #include "chrome/common/search_provider.h" 11 #include "chrome/common/search_provider.h"
12 #include "chrome/common/search_provider.mojom.h"
13 #include "content/public/common/service_registry.h"
14 #include "content/public/renderer/render_thread.h"
12 #include "content/public/renderer/render_view.h" 15 #include "content/public/renderer/render_view.h"
13 #include "third_party/WebKit/public/web/WebDocument.h" 16 #include "third_party/WebKit/public/web/WebDocument.h"
14 #include "third_party/WebKit/public/web/WebLocalFrame.h" 17 #include "third_party/WebKit/public/web/WebLocalFrame.h"
15 #include "third_party/WebKit/public/web/WebView.h" 18 #include "third_party/WebKit/public/web/WebView.h"
16 #include "v8/include/v8.h" 19 #include "v8/include/v8.h"
17 20
18 using blink::WebLocalFrame; 21 using blink::WebLocalFrame;
19 using blink::WebView; 22 using blink::WebView;
20 using content::RenderView; 23 using content::RenderView;
21 24
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return; 107 return;
105 108
106 WebLocalFrame* webframe = WebLocalFrame::frameForCurrentContext(); 109 WebLocalFrame* webframe = WebLocalFrame::frameForCurrentContext();
107 if (!webframe) 110 if (!webframe)
108 return; 111 return;
109 112
110 search_provider::InstallState install = search_provider::DENIED; 113 search_provider::InstallState install = search_provider::DENIED;
111 GURL inquiry_url = GURL(webframe->document().url()).Resolve(name); 114 GURL inquiry_url = GURL(webframe->document().url()).Resolve(name);
112 if (!inquiry_url.is_empty()) { 115 if (!inquiry_url.is_empty()) {
113 webframe->didCallIsSearchProviderInstalled(); 116 webframe->didCallIsSearchProviderInstalled();
114 render_view->Send(new ChromeViewHostMsg_GetSearchProviderInstallState( 117 mojom::SearchProviderInstallStatePtr search_provider_service;
115 render_view->GetRoutingID(), webframe->document().url(), inquiry_url, 118 content::RenderThread::Get()->GetServiceRegistry()->ConnectToRemoteService(
116 &install)); 119 mojo::GetProxy(&search_provider_service));
120 if (!search_provider_service->GetInstallState(webframe->document().url(),
121 inquiry_url, &install)) {
122 DLOG(ERROR) << "Can't fetch search provider install state";
123 }
117 } 124 }
118 125
119 if (install == search_provider::DENIED) { 126 if (install == search_provider::DENIED) {
120 // FIXME: throw access denied exception. 127 // FIXME: throw access denied exception.
121 v8::Isolate* isolate = args.GetIsolate(); 128 v8::Isolate* isolate = args.GetIsolate();
122 isolate->ThrowException(v8::Exception::Error(v8::String::Empty(isolate))); 129 isolate->ThrowException(v8::Exception::Error(v8::String::Empty(isolate)));
123 return; 130 return;
124 } 131 }
125 args.GetReturnValue().Set(static_cast<int32_t>(install)); 132 args.GetReturnValue().Set(static_cast<int32_t>(install));
126 } 133 }
127 134
128 v8::Extension* ExternalExtension::Get() { 135 v8::Extension* ExternalExtension::Get() {
129 return new ExternalExtensionWrapper(); 136 return new ExternalExtensionWrapper();
130 } 137 }
131 138
132 } // namespace extensions_v8 139 } // namespace extensions_v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698