OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/theme_source.h" | 5 #include "chrome/browser/ui/webui/theme_source.h" |
6 | 6 |
7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/resources_util.h" | 10 #include "chrome/browser/resources_util.h" |
11 #include "chrome/browser/themes/theme_service.h" | 11 #include "chrome/browser/themes/theme_service.h" |
12 #include "chrome/browser/themes/theme_service_factory.h" | 12 #include "chrome/browser/themes/theme_service_factory.h" |
13 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" | 13 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
14 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" | 14 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 #include "ui/base/theme_provider.h" | 19 #include "ui/base/theme_provider.h" |
20 | 20 |
| 21 using content::BrowserThread; |
| 22 |
21 // use a resource map rather than hard-coded strings. | 23 // use a resource map rather than hard-coded strings. |
22 static const char* kNewTabCSSPath = "css/newtab.css"; | 24 static const char* kNewTabCSSPath = "css/newtab.css"; |
23 static const char* kNewIncognitoTabCSSPath = "css/newincognitotab.css"; | 25 static const char* kNewIncognitoTabCSSPath = "css/newincognitotab.css"; |
24 | 26 |
25 static std::string StripQueryParams(const std::string& path) { | 27 static std::string StripQueryParams(const std::string& path) { |
26 GURL path_url = GURL(std::string(chrome::kChromeUIScheme) + "://" + | 28 GURL path_url = GURL(std::string(chrome::kChromeUIScheme) + "://" + |
27 std::string(chrome::kChromeUIThemePath) + "/" + path); | 29 std::string(chrome::kChromeUIThemePath) + "/" + path); |
28 return path_url.path().substr(1); // path() always includes a leading '/'. | 30 return path_url.path().substr(1); // path() always includes a leading '/'. |
29 } | 31 } |
30 | 32 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 DCHECK(tp); | 114 DCHECK(tp); |
113 | 115 |
114 scoped_refptr<RefCountedMemory> image_data(tp->GetRawData(resource_id)); | 116 scoped_refptr<RefCountedMemory> image_data(tp->GetRawData(resource_id)); |
115 SendResponse(request_id, image_data); | 117 SendResponse(request_id, image_data); |
116 } else { | 118 } else { |
117 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
118 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 120 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
119 SendResponse(request_id, rb.LoadDataResourceBytes(resource_id)); | 121 SendResponse(request_id, rb.LoadDataResourceBytes(resource_id)); |
120 } | 122 } |
121 } | 123 } |
OLD | NEW |