Commit 203f9640 authored by David Jacobo's avatar David Jacobo Committed by Commit Bot

Remove unused includes from HatService

This CL removes a few unused libraries from HatService and fixes small
style nits. Funcionality is untouched.

Bug: None
Test: Build.
Change-Id: Ic6132da73f728b86a0a8b58afb7021125166a3ac
Reviewed-on: https://chromium-review.googlesource.com/c/1324609
Commit-Queue: David Jacobo <djacobo@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606274}
parent 12ee465b
...@@ -4,39 +4,31 @@ ...@@ -4,39 +4,31 @@
#include "chrome/browser/ui/hats/hats_helper.h" #include "chrome/browser/ui/hats/hats_helper.h"
#include <memory>
#include "base/task/post_task.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/search/search.h" #include "chrome/browser/search/search.h"
#include "chrome/browser/ui/hats/hats_service.h" #include "chrome/browser/ui/hats/hats_service.h"
#include "chrome/browser/ui/hats/hats_service_factory.h" #include "chrome/browser/ui/hats/hats_service_factory.h"
#include "chrome/common/chrome_features.h"
#include "components/search/search.h" #include "components/search/search.h"
#include "content/public/browser/browser_task_traits.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/browser_thread.h"
HatsHelper::~HatsHelper() = default;
HatsHelper::HatsHelper(content::WebContents* web_contents) HatsHelper::HatsHelper(content::WebContents* web_contents)
: WebContentsObserver(web_contents), web_contents_(web_contents) { : WebContentsObserver(web_contents) {
DCHECK(search::IsInstantExtendedAPIEnabled()); DCHECK(search::IsInstantExtendedAPIEnabled());
} }
HatsHelper::~HatsHelper() {}
void HatsHelper::DidFinishLoad(content::RenderFrameHost* render_frame_host, void HatsHelper::DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& /* validated_url */) { const GURL& validated_url) {
if (!render_frame_host->GetParent() && search::IsInstantNTP(web_contents_)) { if (!render_frame_host->GetParent() && search::IsInstantNTP(web_contents())) {
HatsService* hats_service = HatsService* hats_service = HatsServiceFactory::GetForProfile(
HatsServiceFactory::GetForProfile(profile(), true); profile(), /*create_if_necessary=*/true);
if (hats_service) { if (hats_service)
hats_service->LaunchSatisfactionSurvey(); hats_service->LaunchSatisfactionSurvey();
} }
}
} }
Profile* HatsHelper::profile() const { Profile* HatsHelper::profile() const {
return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); return Profile::FromBrowserContext(web_contents()->GetBrowserContext());
} }
...@@ -27,14 +27,12 @@ class HatsHelper : public content::WebContentsObserver, ...@@ -27,14 +27,12 @@ class HatsHelper : public content::WebContentsObserver,
explicit HatsHelper(content::WebContents* web_contents); explicit HatsHelper(content::WebContents* web_contents);
// Overridden from contents::WebContentsObserver: // contents::WebContentsObserver:
void DidFinishLoad(content::RenderFrameHost* render_frame_host, void DidFinishLoad(content::RenderFrameHost* render_frame_host,
const GURL& validated_url) override; const GURL& validated_url) override;
Profile* profile() const; Profile* profile() const;
content::WebContents* web_contents_;
DISALLOW_COPY_AND_ASSIGN(HatsHelper); DISALLOW_COPY_AND_ASSIGN(HatsHelper);
}; };
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
#include "chrome/browser/ui/hats/hats_service.h" #include "chrome/browser/ui/hats/hats_service.h"
#include <stddef.h> #include <utility>
#include <iostream>
#include "base/metrics/field_trial_params.h" #include "base/metrics/field_trial_params.h"
#include "base/rand_util.h" #include "base/rand_util.h"
...@@ -14,23 +12,22 @@ ...@@ -14,23 +12,22 @@
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "content/public/browser/browser_thread.h"
namespace { namespace {
// which survey we're triggering // Which survey we're triggering
const char kHatsSurveyTrigger[] = "survey"; constexpr char kHatsSurveyTrigger[] = "survey";
const char kHatsSurveyProbability[] = "probability"; constexpr char kHatsSurveyProbability[] = "probability";
const char kHatsSurveyEnSiteID[] = "en_site_id"; constexpr char kHatsSurveyEnSiteID[] = "en_site_id";
const char kHatsSurveyTriggerDefault[] = "test"; constexpr char kHatsSurveyTriggerDefault[] = "test";
const double kHatsSurveyProbabilityDefault = 1; constexpr double kHatsSurveyProbabilityDefault = 1;
const char kHatsSurveyEnSiteIDDefault[] = "z4cctguzopq5x2ftal6vdgjrui"; constexpr char kHatsSurveyEnSiteIDDefault[] = "z4cctguzopq5x2ftal6vdgjrui";
const char kHatsSurveyTriggerSatisfaction[] = "satisfaction"; constexpr char kHatsSurveyTriggerSatisfaction[] = "satisfaction";
HatsFinchConfig CreateHatsFinchConfig() { HatsFinchConfig CreateHatsFinchConfig() {
HatsFinchConfig config; HatsFinchConfig config;
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#ifndef CHROME_BROWSER_UI_HATS_HATS_SERVICE_H_ #ifndef CHROME_BROWSER_UI_HATS_HATS_SERVICE_H_
#define CHROME_BROWSER_UI_HATS_HATS_SERVICE_H_ #define CHROME_BROWSER_UI_HATS_HATS_SERVICE_H_
#include <stddef.h>
#include <map> #include <map>
#include <string> #include <string>
......
...@@ -39,4 +39,4 @@ KeyedService* HatsServiceFactory::BuildServiceInstanceFor( ...@@ -39,4 +39,4 @@ KeyedService* HatsServiceFactory::BuildServiceInstanceFor(
: new HatsService(profile); : new HatsService(profile);
} }
HatsServiceFactory::~HatsServiceFactory() {} HatsServiceFactory::~HatsServiceFactory() = default;
...@@ -23,7 +23,7 @@ class HatsServiceFactory : public BrowserContextKeyedServiceFactory { ...@@ -23,7 +23,7 @@ class HatsServiceFactory : public BrowserContextKeyedServiceFactory {
HatsServiceFactory(); HatsServiceFactory();
~HatsServiceFactory() override; ~HatsServiceFactory() override;
// Overrides from BrowserContextKeyedServiceFactory: // BrowserContextKeyedServiceFactory:
KeyedService* BuildServiceInstanceFor( KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const override; content::BrowserContext* context) const override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment