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

Side by Side Diff: chrome/browser/themes/theme_properties.cc

Issue 747013003: Various optimizations to reduce the number of temporary allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added back calls to c_str that were removed by mistake. Created 6 years 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
« no previous file with comments | « chrome/browser/themes/theme_properties.h ('k') | chrome/browser/themes/theme_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/themes/theme_properties.h" 5 #include "chrome/browser/themes/theme_properties.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/themes/browser_theme_pack.h" 10 #include "chrome/browser/themes/browser_theme_pack.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (tiling == REPEAT_X) 194 if (tiling == REPEAT_X)
195 return kTilingRepeatX; 195 return kTilingRepeatX;
196 if (tiling == REPEAT_Y) 196 if (tiling == REPEAT_Y)
197 return kTilingRepeatY; 197 return kTilingRepeatY;
198 if (tiling == REPEAT) 198 if (tiling == REPEAT)
199 return kTilingRepeat; 199 return kTilingRepeat;
200 return kTilingNoRepeat; 200 return kTilingNoRepeat;
201 } 201 }
202 202
203 // static 203 // static
204 bool ThemeProperties::IsThemeableImage(int id) {
205 // TODO(pkotwicz): Cache results to improve lookup speed.
206 std::set<int> themeable_idrs;
207 BrowserThemePack::GetThemeableImageIDRs(&themeable_idrs);
208 return themeable_idrs.find(id) != themeable_idrs.end();
209 }
210
211 // static
212 const std::set<int>& ThemeProperties::GetTintableToolbarButtons() { 204 const std::set<int>& ThemeProperties::GetTintableToolbarButtons() {
213 CR_DEFINE_STATIC_LOCAL(std::set<int>, button_set, ()); 205 CR_DEFINE_STATIC_LOCAL(std::set<int>, button_set, ());
214 if (button_set.empty()) { 206 if (button_set.empty()) {
215 button_set = std::set<int>( 207 button_set = std::set<int>(
216 kToolbarButtonIDs, 208 kToolbarButtonIDs,
217 kToolbarButtonIDs + arraysize(kToolbarButtonIDs)); 209 kToolbarButtonIDs + arraysize(kToolbarButtonIDs));
218 } 210 }
219 211
220 return button_set; 212 return button_set;
221 } 213 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 case NTP_BACKGROUND_ALIGNMENT: 303 case NTP_BACKGROUND_ALIGNMENT:
312 return kDefaultDisplayPropertyNTPAlignment; 304 return kDefaultDisplayPropertyNTPAlignment;
313 case NTP_BACKGROUND_TILING: 305 case NTP_BACKGROUND_TILING:
314 return kDefaultDisplayPropertyNTPTiling; 306 return kDefaultDisplayPropertyNTPTiling;
315 case NTP_LOGO_ALTERNATE: 307 case NTP_LOGO_ALTERNATE:
316 return kDefaultDisplayPropertyNTPAlternateLogo; 308 return kDefaultDisplayPropertyNTPAlternateLogo;
317 } 309 }
318 310
319 return -1; 311 return -1;
320 } 312 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_properties.h ('k') | chrome/browser/themes/theme_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698