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

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

Issue 13375003: Fixing iframe jank in the local omnibox popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebuilding on 14039004. Created 7 years, 8 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 #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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 ThemeSource::~ThemeSource() { 50 ThemeSource::~ThemeSource() {
51 } 51 }
52 52
53 std::string ThemeSource::GetSource() const { 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 int render_process_id,
60 int render_view_id,
60 const content::URLDataSource::GotDataCallback& callback) { 61 const content::URLDataSource::GotDataCallback& callback) {
61 // Default scale factor if not specified. 62 // Default scale factor if not specified.
62 ui::ScaleFactor scale_factor; 63 ui::ScaleFactor scale_factor;
63 std::string uncached_path; 64 std::string uncached_path;
64 webui::ParsePathAndScale(GURL(GetThemePath() + path), 65 webui::ParsePathAndScale(GURL(GetThemePath() + path),
65 &uncached_path, 66 &uncached_path,
66 &scale_factor); 67 &scale_factor);
67 68
68 if (uncached_path == kNewTabCSSPath || 69 if (uncached_path == kNewTabCSSPath ||
69 uncached_path == kNewIncognitoTabCSSPath) { 70 uncached_path == kNewIncognitoTabCSSPath) {
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
71 DCHECK((uncached_path == kNewTabCSSPath && !is_incognito) ||
72 (uncached_path == kNewIncognitoTabCSSPath && is_incognito));
palmer 2013/04/22 19:38:37 Are we sure it's safe to remove this DCHECK?
Jered 2013/04/22 23:02:58 Yes. The owners agreed this was ok in https://code
73 72
74 callback.Run(css_bytes_); 73 callback.Run(css_bytes_);
75 return; 74 return;
76 } 75 }
77 76
78 77
79 int resource_id = ResourcesUtil::GetThemeResourceId(uncached_path); 78 int resource_id = ResourcesUtil::GetThemeResourceId(uncached_path);
80 if (resource_id != -1) { 79 if (resource_id != -1) {
81 SendThemeBitmap(callback, resource_id, scale_factor); 80 SendThemeBitmap(callback, resource_id, scale_factor);
82 return; 81 return;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 143
145 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData( 144 scoped_refptr<base::RefCountedMemory> image_data(tp->GetRawData(
146 resource_id, scale_factor)); 145 resource_id, scale_factor));
147 callback.Run(image_data); 146 callback.Run(image_data);
148 } else { 147 } else {
149 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
150 const ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 149 const ResourceBundle& rb = ResourceBundle::GetSharedInstance();
151 callback.Run(rb.LoadDataResourceBytesForScale(resource_id, scale_factor)); 150 callback.Run(rb.LoadDataResourceBytesForScale(resource_id, scale_factor));
152 } 151 }
153 } 152 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698