| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_ | 5 #ifndef CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_ |
| 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_ | 6 #define CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" | 12 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 13 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 // FavIconSource is the gateway between network-level chrome: | 18 // FavIconSource is the gateway between network-level chrome: |
| 19 // requests for favicons and the history backend that serves these. | 19 // requests for favicons and the history backend that serves these. |
| 20 class DOMUIFavIconSource : public ChromeURLDataManager::DataSource { | 20 class DOMUIFavIconSource : public ChromeURLDataManager::DataSource { |
| 21 public: | 21 public: |
| 22 explicit DOMUIFavIconSource(Profile* profile); | 22 explicit DOMUIFavIconSource(Profile* profile); |
| 23 virtual ~DOMUIFavIconSource() { } |
| 23 | 24 |
| 24 // Called when the network layer has requested a resource underneath | 25 // Called when the network layer has requested a resource underneath |
| 25 // the path we registered. | 26 // the path we registered. |
| 26 virtual void StartDataRequest(const std::string& path, int request_id); | 27 virtual void StartDataRequest(const std::string& path, int request_id); |
| 27 | 28 |
| 28 virtual std::string GetMimeType(const std::string&) const { | 29 virtual std::string GetMimeType(const std::string&) const { |
| 29 // We need to explicitly return a mime type, otherwise if the user tries to | 30 // We need to explicitly return a mime type, otherwise if the user tries to |
| 30 // drag the image they get no extension. | 31 // drag the image they get no extension. |
| 31 return "image/png"; | 32 return "image/png"; |
| 32 } | 33 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 43 CancelableRequestConsumerT<int, 0> cancelable_consumer_; | 44 CancelableRequestConsumerT<int, 0> cancelable_consumer_; |
| 44 | 45 |
| 45 // Raw PNG representation of the favicon to show when the favicon | 46 // Raw PNG representation of the favicon to show when the favicon |
| 46 // database doesn't have a favicon for a webpage. | 47 // database doesn't have a favicon for a webpage. |
| 47 scoped_refptr<RefCountedBytes> default_favicon_; | 48 scoped_refptr<RefCountedBytes> default_favicon_; |
| 48 | 49 |
| 49 DISALLOW_COPY_AND_ASSIGN(DOMUIFavIconSource); | 50 DISALLOW_COPY_AND_ASSIGN(DOMUIFavIconSource); |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_ | 53 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_ |
| OLD | NEW |