OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/android/logo_service.h" | 5 #include "chrome/browser/android/logo_service.h" |
6 | 6 |
7 #include "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "chrome/browser/google/google_profile_helper.h" |
8 #include "chrome/browser/google/google_url_tracker.h" | 9 #include "chrome/browser/google/google_url_tracker.h" |
9 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
10 #include "chrome/browser/image_decoder.h" | 11 #include "chrome/browser/image_decoder.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/search_engines/template_url_service.h" | 13 #include "chrome/browser/search_engines/template_url_service.h" |
13 #include "chrome/browser/search_engines/template_url_service_factory.h" | 14 #include "chrome/browser/search_engines/template_url_service_factory.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/search_provider_logos/google_logo_api.h" | 16 #include "components/search_provider_logos/google_logo_api.h" |
16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
17 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
(...skipping 14 matching lines...) Expand all Loading... |
32 // Google domain. | 33 // Google domain. |
33 GURL GetGoogleDoodleURL(Profile* profile) { | 34 GURL GetGoogleDoodleURL(Profile* profile) { |
34 // SetPathStr() requires its argument to stay in scope as long as | 35 // SetPathStr() requires its argument to stay in scope as long as |
35 // |replacements| is, so a std::string is needed, instead of a char*. | 36 // |replacements| is, so a std::string is needed, instead of a char*. |
36 std::string path = kGoogleDoodleURLPath; | 37 std::string path = kGoogleDoodleURLPath; |
37 GURL::Replacements replacements; | 38 GURL::Replacements replacements; |
38 replacements.SetPathStr(path); | 39 replacements.SetPathStr(path); |
39 | 40 |
40 GURL base_url(google_util::CommandLineGoogleBaseURL()); | 41 GURL base_url(google_util::CommandLineGoogleBaseURL()); |
41 if (!base_url.is_valid()) | 42 if (!base_url.is_valid()) |
42 base_url = GoogleURLTracker::GoogleURL(profile); | 43 base_url = google_profile_helper::GetGoogleHomePageURL(profile); |
43 return base_url.ReplaceComponents(replacements); | 44 return base_url.ReplaceComponents(replacements); |
44 } | 45 } |
45 | 46 |
46 class LogoDecoderDelegate : public ImageDecoder::Delegate { | 47 class LogoDecoderDelegate : public ImageDecoder::Delegate { |
47 public: | 48 public: |
48 LogoDecoderDelegate( | 49 LogoDecoderDelegate( |
49 const scoped_refptr<ImageDecoder>& image_decoder, | 50 const scoped_refptr<ImageDecoder>& image_decoder, |
50 const base::Callback<void(const SkBitmap&)>& image_decoded_callback) | 51 const base::Callback<void(const SkBitmap&)>& image_decoded_callback) |
51 : image_decoder_(image_decoder), | 52 : image_decoder_(image_decoder), |
52 image_decoded_callback_(image_decoded_callback), | 53 image_decoded_callback_(image_decoded_callback), |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 167 } |
167 | 168 |
168 LogoServiceFactory::~LogoServiceFactory() {} | 169 LogoServiceFactory::~LogoServiceFactory() {} |
169 | 170 |
170 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( | 171 KeyedService* LogoServiceFactory::BuildServiceInstanceFor( |
171 content::BrowserContext* context) const { | 172 content::BrowserContext* context) const { |
172 Profile* profile = static_cast<Profile*>(context); | 173 Profile* profile = static_cast<Profile*>(context); |
173 DCHECK(!profile->IsOffTheRecord()); | 174 DCHECK(!profile->IsOffTheRecord()); |
174 return new LogoService(profile); | 175 return new LogoService(profile); |
175 } | 176 } |
OLD | NEW |