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

Side by Side Diff: chrome/browser/ui/webui/theme_source.h

Issue 11885021: Don't derive from ChromeURLDataManager::DataSource, and instead have these classes implement a dele… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: nits Created 7 years, 11 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 | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_
6 #define CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ 6 #define CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "content/public/browser/url_data_source_delegate.h"
11 #include "ui/base/layout.h" 13 #include "ui/base/layout.h"
12 14
13 class Profile; 15 class Profile;
14 16
15 namespace base { 17 namespace base {
16 class RefCountedMemory; 18 class RefCountedMemory;
17 } 19 }
18 20
19 class ThemeSource : public ChromeURLDataManager::DataSource { 21 class ThemeSource : public content::URLDataSourceDelegate {
20 public: 22 public:
21 explicit ThemeSource(Profile* profile); 23 explicit ThemeSource(Profile* profile);
22 24
23 // Called when the network layer has requested a resource underneath 25 // content::URLDataSourceDelegate implementation.
24 // the path we registered. 26 virtual std::string GetSource() OVERRIDE;
25 virtual void StartDataRequest(const std::string& path, 27 virtual void StartDataRequest(const std::string& path,
26 bool is_incognito, 28 bool is_incognito,
27 int request_id) OVERRIDE; 29 int request_id) OVERRIDE;
28 virtual std::string GetMimeType(const std::string& path) const OVERRIDE; 30 virtual std::string GetMimeType(const std::string& path) const OVERRIDE;
29
30 // Used to tell ChromeURLDataManager which thread to handle the request on.
31 virtual MessageLoop* MessageLoopForRequestPath( 31 virtual MessageLoop* MessageLoopForRequestPath(
32 const std::string& path) const OVERRIDE; 32 const std::string& path) const OVERRIDE;
33
34 virtual bool ShouldReplaceExistingSource() const OVERRIDE; 33 virtual bool ShouldReplaceExistingSource() const OVERRIDE;
35 34
36 protected: 35 protected:
37 virtual ~ThemeSource(); 36 virtual ~ThemeSource();
38 37
39 private: 38 private:
40 // Fetch and send the theme bitmap. 39 // Fetch and send the theme bitmap.
41 void SendThemeBitmap(int request_id, 40 void SendThemeBitmap(int request_id,
42 int resource_id, 41 int resource_id,
43 ui::ScaleFactor scale_factor); 42 ui::ScaleFactor scale_factor);
44 43
45 // The original profile (never an OTR profile). 44 // The original profile (never an OTR profile).
46 Profile* profile_; 45 Profile* profile_;
47 46
48 // We grab the CSS early so we don't have to go back to the UI thread later. 47 // We grab the CSS early so we don't have to go back to the UI thread later.
49 scoped_refptr<base::RefCountedMemory> css_bytes_; 48 scoped_refptr<base::RefCountedMemory> css_bytes_;
50 49
51 DISALLOW_COPY_AND_ASSIGN(ThemeSource); 50 DISALLOW_COPY_AND_ASSIGN(ThemeSource);
52 }; 51 };
53 52
54 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_ 53 #endif // CHROME_BROWSER_UI_WEBUI_THEME_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698