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/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 "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 ThemeSource::ThemeSource(Profile* profile) | 44 ThemeSource::ThemeSource(Profile* profile) |
45 : profile_(profile->GetOriginalProfile()) { | 45 : profile_(profile->GetOriginalProfile()) { |
46 css_bytes_ = NTPResourceCacheFactory::GetForProfile(profile)->GetNewTabCSS( | 46 css_bytes_ = NTPResourceCacheFactory::GetForProfile(profile)->GetNewTabCSS( |
47 profile->IsOffTheRecord()); | 47 profile->IsOffTheRecord()); |
48 } | 48 } |
49 | 49 |
50 ThemeSource::~ThemeSource() { | 50 ThemeSource::~ThemeSource() { |
51 } | 51 } |
52 | 52 |
53 std::string ThemeSource::GetSource() { | 53 std::string ThemeSource::GetSource() const { |
54 return chrome::kChromeUIThemePath; | 54 return chrome::kChromeUIThemePath; |
55 } | 55 } |
56 | 56 |
57 void ThemeSource::StartDataRequest( | 57 void ThemeSource::StartDataRequest( |
58 const std::string& path, | 58 const std::string& path, |
59 bool is_incognito, | 59 bool is_incognito, |
60 const content::URLDataSource::GotDataCallback& callback) { | 60 const content::URLDataSource::GotDataCallback& callback) { |
61 // Default scale factor if not specified. | 61 // Default scale factor if not specified. |
62 ui::ScaleFactor scale_factor; | 62 ui::ScaleFactor scale_factor; |
63 std::string uncached_path; | 63 std::string uncached_path; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( | 145 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( |
146 resource_id, scale_factor)); | 146 resource_id, scale_factor)); |
147 callback.Run(image_data); | 147 callback.Run(image_data); |
148 } else { | 148 } else { |
149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
150 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 150 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
151 callback.Run(rb.LoadDataResourceBytesForScale(resource_id, scale_factor)); | 151 callback.Run(rb.LoadDataResourceBytesForScale(resource_id, scale_factor)); |
152 } | 152 } |
153 } | 153 } |
OLD | NEW |