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

Unified Diff: chrome/browser/tab_contents/origins_seen_service_factory.cc

Issue 1844753002: Histogram the scheme of an origin on the 1st navigation to it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplifications thanks to avi. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/origins_seen_service_factory.cc
diff --git a/chrome/browser/tab_contents/origins_seen_service_factory.cc b/chrome/browser/tab_contents/origins_seen_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3a270c72b740700e0759a8a4f0a92e95ae426681
--- /dev/null
+++ b/chrome/browser/tab_contents/origins_seen_service_factory.cc
@@ -0,0 +1,39 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/tab_contents/origins_seen_service_factory.h"
+
+#include "chrome/browser/profiles/incognito_helpers.h"
Avi (use Gerrit) 2016/04/14 19:08:02 Do you need this?
palmer 2016/04/14 20:13:41 Done.
+#include "chrome/browser/profiles/profile.h"
Avi (use Gerrit) 2016/04/14 19:08:02 You don't need this line...
palmer 2016/04/14 20:13:41 Done.
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+// static
+OriginsSeenService* OriginsSeenServiceFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ return static_cast<OriginsSeenService*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+OriginsSeenServiceFactory* OriginsSeenServiceFactory::GetInstance() {
+ return base::Singleton<OriginsSeenServiceFactory>::get();
+}
+
+// static
+KeyedService* OriginsSeenServiceFactory::BuildInstanceFor(
+ content::BrowserContext* context) {
+ return new OriginsSeenService();
+}
+
+OriginsSeenServiceFactory::OriginsSeenServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "OriginsSeenService",
+ BrowserContextDependencyManager::GetInstance()) {}
+
+OriginsSeenServiceFactory::~OriginsSeenServiceFactory() {}
+
+KeyedService* OriginsSeenServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* profile) const {
Avi (use Gerrit) 2016/04/14 19:08:02 |context|, not |profile|.
palmer 2016/04/14 20:13:41 Done.
+ return BuildInstanceFor(static_cast<Profile*>(profile));
Avi (use Gerrit) 2016/04/14 19:08:02 ... because you don't need this cast, as BuildInst
palmer 2016/04/14 20:13:41 Done.
+}

Powered by Google App Engine
This is Rietveld 408576698