| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/session_favicon_source.h" | 5 #include "chrome/browser/ui/webui/session_favicon_source.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/glue/session_model_associator.h" | 7 #include "chrome/browser/sync/glue/session_model_associator.h" |
| 8 #include "chrome/browser/sync/profile_sync_service_factory.h" | 8 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 9 #include "chrome/browser/sync/profile_sync_service.h" | 9 #include "chrome/browser/sync/profile_sync_service.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 | 11 |
| 12 using browser_sync::SessionModelAssociator; | 12 using browser_sync::SessionModelAssociator; |
| 13 | 13 |
| 14 SessionFaviconSource::SessionFaviconSource(Profile* profile) | 14 SessionFaviconSource::SessionFaviconSource(Profile* profile) |
| 15 : FaviconSource(profile, FaviconSource::FAVICON) { | 15 : FaviconSource(profile, FaviconSource::FAVICON) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 SessionFaviconSource::~SessionFaviconSource() { | 18 SessionFaviconSource::~SessionFaviconSource() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 std::string SessionFaviconSource::GetSource() { | 21 std::string SessionFaviconSource::GetSource() const { |
| 22 return chrome::kChromeUISessionFaviconHost; | 22 return chrome::kChromeUISessionFaviconHost; |
| 23 } | 23 } |
| 24 | 24 |
| 25 std::string SessionFaviconSource::GetMimeType(const std::string&) const { | 25 std::string SessionFaviconSource::GetMimeType(const std::string&) const { |
| 26 return "image/png"; | 26 return "image/png"; |
| 27 } | 27 } |
| 28 | 28 |
| 29 bool SessionFaviconSource::ShouldReplaceExistingSource() const { | 29 bool SessionFaviconSource::ShouldReplaceExistingSource() const { |
| 30 // Leave the existing DataSource in place, otherwise we'll drop any pending | 30 // Leave the existing DataSource in place, otherwise we'll drop any pending |
| 31 // requests on the floor. | 31 // requests on the floor. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 | 46 |
| 47 scoped_refptr<base::RefCountedMemory> response; | 47 scoped_refptr<base::RefCountedMemory> response; |
| 48 if (associator && | 48 if (associator && |
| 49 associator->GetSyncedFaviconForPageURL(request.request_path, | 49 associator->GetSyncedFaviconForPageURL(request.request_path, |
| 50 &response)) { | 50 &response)) { |
| 51 request.callback.Run(response); | 51 request.callback.Run(response); |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| OLD | NEW |