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

Side by Side Diff: chrome/browser/ui/views/theme_background.cc

Issue 13420002: views: Remove unused theme_background.* files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/views/theme_background.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/views/theme_background.h"
6
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/themes/theme_service.h"
9 #include "chrome/browser/themes/theme_service_factory.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/browser/ui/views/theme_image_mapper.h"
13 #include "grit/generated_resources.h"
14 #include "grit/theme_resources.h"
15 #include "grit/ui_resources.h"
16 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/canvas.h"
18 #include "ui/views/view.h"
19
20 ThemeBackground::ThemeBackground(BrowserView* browser_view)
21 : browser_view_(browser_view) {
22 }
23
24 void ThemeBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
25 gfx::ImageSkia* background;
26
27 if (!browser_view_->IsBrowserTypeNormal()) {
28 // Never theme app and popup windows.
29 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
30 if (browser_view_->IsActive())
31 background = rb.GetImageSkiaNamed(IDR_FRAME);
32 else
33 background = rb.GetImageSkiaNamed(IDR_THEME_FRAME_INACTIVE);
34 } else {
35 Profile* profile = browser_view_->browser()->profile();
36 ui::ThemeProvider* theme = view->GetThemeProvider();
37 DCHECK(theme); // Should be parented to a Widget when painting.
38
39 if (browser_view_->IsActive()) {
40 background = theme->GetImageSkiaNamed(
41 profile->IsOffTheRecord() ?
42 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME);
43 } else {
44 background = theme->GetImageSkiaNamed(
45 profile->IsOffTheRecord() ?
46 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE);
47 }
48 }
49
50 gfx::Point origin;
51 views::View::ConvertPointToTarget(view,
52 browser_view_->frame()->GetFrameView(),
53 &origin);
54 canvas->TileImageInt(*background,
55 origin.x(), origin.y(), 0, 0,
56 view->width(), view->height());
57 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/theme_background.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698