Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/dom_ui/dom_ui_favicon_source.h

Issue 3061009: Speculative fix for crash in DOMUIThumbnailSource. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: msvc++ caught this Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" 13 #include "chrome/browser/dom_ui/chrome_url_data_manager.h"
14 #include "chrome/browser/favicon_service.h" 14 #include "chrome/browser/favicon_service.h"
15 15
16 class GURL; 16 class GURL;
17 class Profile; 17 class Profile;
18 18
19 // FavIconSource is the gateway between network-level chrome: 19 // FavIconSource is the gateway between network-level chrome:
20 // requests for favicons and the history backend that serves these. 20 // requests for favicons and the history backend that serves these.
21 class DOMUIFavIconSource : public ChromeURLDataManager::DataSource { 21 class DOMUIFavIconSource : public ChromeURLDataManager::DataSource {
22 public: 22 public:
23 explicit DOMUIFavIconSource(Profile* profile); 23 explicit DOMUIFavIconSource(Profile* profile);
24 24
25 // Called when the network layer has requested a resource underneath 25 // Called when the network layer has requested a resource underneath
26 // the path we registered. 26 // the path we registered.
27 virtual void StartDataRequest(const std::string& path, 27 virtual void StartDataRequest(const std::string& path,
28 bool is_off_the_record, 28 bool is_off_the_record,
29 int request_id); 29 int request_id);
30 30
31 virtual std::string GetMimeType(const std::string&) const { 31 virtual std::string GetMimeType(const std::string&) const;
32 // We need to explicitly return a mime type, otherwise if the user tries to
33 // drag the image they get no extension.
34 return "image/png";
35 }
36 32
37 // Called when favicon data is available from the history backend. 33 // Called when favicon data is available from the history backend.
38 void OnFavIconDataAvailable(FaviconService::Handle request_handle, 34 void OnFavIconDataAvailable(FaviconService::Handle request_handle,
39 bool know_favicon, 35 bool know_favicon,
40 scoped_refptr<RefCountedMemory> data, 36 scoped_refptr<RefCountedMemory> data,
41 bool expired, 37 bool expired,
42 GURL url); 38 GURL url);
43 39
44 private: 40 private:
45 virtual ~DOMUIFavIconSource() {} 41 virtual ~DOMUIFavIconSource();
46 42
47 Profile* profile_; 43 Profile* profile_;
48 CancelableRequestConsumerT<int, 0> cancelable_consumer_; 44 CancelableRequestConsumerT<int, 0> cancelable_consumer_;
49 45
50 // Raw PNG representation of the favicon to show when the favicon 46 // Raw PNG representation of the favicon to show when the favicon
51 // database doesn't have a favicon for a webpage. 47 // database doesn't have a favicon for a webpage.
52 scoped_refptr<RefCountedMemory> default_favicon_; 48 scoped_refptr<RefCountedMemory> default_favicon_;
53 49
54 DISALLOW_COPY_AND_ASSIGN(DOMUIFavIconSource); 50 DISALLOW_COPY_AND_ASSIGN(DOMUIFavIconSource);
55 }; 51 };
56 52
57 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_ 53 #endif // CHROME_BROWSER_DOM_UI_DOM_UI_FAVICON_SOURCE_H_
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/chrome_url_data_manager.cc ('k') | chrome/browser/dom_ui/dom_ui_favicon_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698