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 "ios/chrome/browser/google/google_logo_service.h" | 5 #include "ios/chrome/browser/google/google_logo_service.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 : browser_state_(browser_state) {} | 85 : browser_state_(browser_state) {} |
86 | 86 |
87 GoogleLogoService::~GoogleLogoService() {} | 87 GoogleLogoService::~GoogleLogoService() {} |
88 | 88 |
89 void GoogleLogoService::GetLogo(search_provider_logos::LogoObserver* observer) { | 89 void GoogleLogoService::GetLogo(search_provider_logos::LogoObserver* observer) { |
90 TemplateURLService* template_url_service = | 90 TemplateURLService* template_url_service = |
91 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state_); | 91 ios::TemplateURLServiceFactory::GetForBrowserState(browser_state_); |
92 if (!template_url_service) | 92 if (!template_url_service) |
93 return; | 93 return; |
94 | 94 |
95 TemplateURL* template_url = template_url_service->GetDefaultSearchProvider(); | 95 const TemplateURL* template_url = |
| 96 template_url_service->GetDefaultSearchProvider(); |
96 if (!template_url || | 97 if (!template_url || |
97 !template_url->url_ref().HasGoogleBaseURLs( | 98 !template_url->url_ref().HasGoogleBaseURLs( |
98 template_url_service->search_terms_data())) | 99 template_url_service->search_terms_data())) |
99 return; | 100 return; |
100 | 101 |
101 if (!logo_tracker_) { | 102 if (!logo_tracker_) { |
102 logo_tracker_.reset(new LogoTracker( | 103 logo_tracker_.reset(new LogoTracker( |
103 DoodleDirectory(), | 104 DoodleDirectory(), |
104 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE), | 105 web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE), |
105 web::WebThread::GetBlockingPool(), browser_state_->GetRequestContext(), | 106 web::WebThread::GetBlockingPool(), browser_state_->GetRequestContext(), |
(...skipping 21 matching lines...) Expand all Loading... |
127 cached_metadata_ = empty_metadata; | 128 cached_metadata_ = empty_metadata; |
128 } | 129 } |
129 } | 130 } |
130 | 131 |
131 search_provider_logos::Logo GoogleLogoService::GetCachedLogo() { | 132 search_provider_logos::Logo GoogleLogoService::GetCachedLogo() { |
132 search_provider_logos::Logo logo; | 133 search_provider_logos::Logo logo; |
133 logo.image = cached_image_; | 134 logo.image = cached_image_; |
134 logo.metadata = cached_metadata_; | 135 logo.metadata = cached_metadata_; |
135 return logo; | 136 return logo; |
136 } | 137 } |
OLD | NEW |