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

Side by Side Diff: chrome/browser/dom_ui/dom_ui_theme_source.cc

Issue 194066: Fix problem of white box appearing in themes without an NTP background image.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/dom_ui/dom_ui_theme_source.h" 5 #include "chrome/browser/dom_ui/dom_ui_theme_source.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/resource_bundle.h" 8 #include "app/resource_bundle.h"
9 #include "app/theme_provider.h" 9 #include "app/theme_provider.h"
10 #include "base/gfx/png_encoder.h" 10 #include "base/gfx/png_encoder.h"
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } else { 248 } else {
249 SendResponse(request_id, NULL); 249 SendResponse(request_id, NULL);
250 } 250 }
251 } 251 }
252 252
253 std::string DOMUIThemeSource::GetNewTabBackgroundCSS(bool bar_attached) { 253 std::string DOMUIThemeSource::GetNewTabBackgroundCSS(bool bar_attached) {
254 int alignment; 254 int alignment;
255 profile_->GetThemeProvider()->GetDisplayProperty( 255 profile_->GetThemeProvider()->GetDisplayProperty(
256 BrowserThemeProvider::NTP_BACKGROUND_ALIGNMENT, &alignment); 256 BrowserThemeProvider::NTP_BACKGROUND_ALIGNMENT, &alignment);
257 257
258 // TODO(glen): This is a quick workaround to hide the notused.png image when
259 // no image is provided - we don't have time right now to figure out why
260 // this is painting as white.
261 // http://crbug.com/17593
262 if (!profile_->GetThemeProvider()->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) {
263 return "-64px";
264 }
265
258 if (bar_attached) 266 if (bar_attached)
259 return BrowserThemeProvider::AlignmentToString(alignment); 267 return BrowserThemeProvider::AlignmentToString(alignment);
260 268
261 // The bar is detached, so we must offset the background by the bar size 269 // The bar is detached, so we must offset the background by the bar size
262 // if it's a top-aligned bar. 270 // if it's a top-aligned bar.
263 #if defined(OS_WIN) 271 #if defined(OS_WIN)
264 int offset = BookmarkBarView::kNewtabBarHeight; 272 int offset = BookmarkBarView::kNewtabBarHeight;
265 #else 273 #else
266 int offset = 0; 274 int offset = 0;
267 #endif 275 #endif
268 276
269 // TODO(glen): This is a quick workaround to hide the notused.png image when
270 // no image is provided - we don't have time right now to figure out why
271 // this is painting as white.
272 // http://crbug.com/17593
273 if (!profile_->GetThemeProvider()->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) {
274 return "-64px";
275 }
276
277 if (alignment & BrowserThemeProvider::ALIGN_TOP) { 277 if (alignment & BrowserThemeProvider::ALIGN_TOP) {
278 if (alignment & BrowserThemeProvider::ALIGN_LEFT) 278 if (alignment & BrowserThemeProvider::ALIGN_LEFT)
279 return "0% " + IntToString(-offset) + "px"; 279 return "0% " + IntToString(-offset) + "px";
280 else if (alignment & BrowserThemeProvider::ALIGN_RIGHT) 280 else if (alignment & BrowserThemeProvider::ALIGN_RIGHT)
281 return "100% " + IntToString(-offset) + "px"; 281 return "100% " + IntToString(-offset) + "px";
282 return "center " + IntToString(-offset) + "px"; 282 return "center " + IntToString(-offset) + "px";
283 } 283 }
284 return BrowserThemeProvider::AlignmentToString(alignment); 284 return BrowserThemeProvider::AlignmentToString(alignment);
285 } 285 }
286 286
287 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() { 287 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() {
288 int repeat_mode; 288 int repeat_mode;
289 profile_->GetThemeProvider()->GetDisplayProperty( 289 profile_->GetThemeProvider()->GetDisplayProperty(
290 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); 290 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode);
291 return BrowserThemeProvider::TilingToString(repeat_mode); 291 return BrowserThemeProvider::TilingToString(repeat_mode);
292 } 292 }
293 293
OLDNEW
« chrome/browser/browser_theme_provider.cc ('K') | « chrome/browser/browser_theme_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698