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

Unified Diff: chrome/browser/search_engines/search_provider_install_state_impl.cc

Issue 2170313002: Remove OwnedInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/search_provider_install_state_impl.cc
diff --git a/chrome/browser/search_engines/search_provider_install_state_impl.cc b/chrome/browser/search_engines/search_provider_install_state_impl.cc
index 3d9a9378133b7506dc941ce6c37b3bd2ebe54c11..f6061ccdee6c1f1832a6888f183bb9d5e0aa0b1d 100644
--- a/chrome/browser/search_engines/search_provider_install_state_impl.cc
+++ b/chrome/browser/search_engines/search_provider_install_state_impl.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
#include "chrome/common/search_provider.mojom.h"
-#include "content/public/browser/owned_interface.h"
#include "content/public/browser/render_process_host.h"
#include "services/shell/public/cpp/interface_registry.h"
#include "url/gurl.h"
@@ -26,6 +25,7 @@ SearchProviderInstallStateImpl::SearchProviderInstallStateImpl(
GoogleURLTrackerFactory::GetForProfile(profile),
content::RenderProcessHost::FromID(render_process_id)),
is_off_the_record_(profile->IsOffTheRecord()),
+ binding_(this),
weak_factory_(this) {
// This is initialized by RenderProcessHostImpl. Do not add any non-trivial
// initialization here. Instead do it lazily when required.
@@ -36,9 +36,23 @@ SearchProviderInstallStateImpl::~SearchProviderInstallStateImpl() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
}
-void SearchProviderInstallStateImpl::Bind(
+// static
+void SearchProviderInstallStateImpl::Create(
+ int render_process_id,
+ Profile* profile,
+ chrome::mojom::SearchProviderInstallStateRequest request) {
+ // BindOnIOThread takes ownership on the impl object:
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&SearchProviderInstallStateImpl::BindOnIOThread,
+ base::Unretained(new SearchProviderInstallStateImpl(
leonhsl(Using Gerrit) 2016/07/26 02:28:34 Why don't we do new/bind together on IO thread? If
tibell 2016/07/26 02:40:48 The fields in the class need to be initialized on
+ render_process_id, profile)),
+ base::Passed(&request)));
+}
+
+void SearchProviderInstallStateImpl::BindOnIOThread(
chrome::mojom::SearchProviderInstallStateRequest request) {
- binding_set_.AddBinding(this, std::move(request));
+ binding_.Bind(std::move(request));
}
chrome::mojom::InstallState

Powered by Google App Engine
This is Rietveld 408576698