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

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

Issue 535005: Don't theme app/popup window (Closed)
Patch Set: " Created 10 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/theme_background.h" 5 #include "chrome/browser/views/theme_background.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/resource_bundle.h"
8 #include "chrome/browser/browser_theme_provider.h" 9 #include "chrome/browser/browser_theme_provider.h"
9 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
10 #include "chrome/browser/views/frame/browser_view.h" 11 #include "chrome/browser/views/frame/browser_view.h"
12 #include "grit/app_resources.h"
11 #include "grit/generated_resources.h" 13 #include "grit/generated_resources.h"
12 #include "grit/theme_resources.h" 14 #include "grit/theme_resources.h"
13 #include "views/view.h" 15 #include "views/view.h"
14 16
15 ThemeBackground::ThemeBackground(BrowserView* browser_view) 17 ThemeBackground::ThemeBackground(BrowserView* browser_view)
16 : browser_view_(browser_view) { 18 : browser_view_(browser_view) {
17 } 19 }
18 20
19 void ThemeBackground::Paint(gfx::Canvas* canvas, views::View* view) const { 21 void ThemeBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
20 int image_name; 22 SkBitmap* background;
21 Browser* browser = browser_view_->browser(); 23
22 if (browser->window()->IsActive()) { 24 // Never theme app and popup windows.
23 image_name = browser->profile()->IsOffTheRecord() ? 25 if (!browser_view_->IsBrowserTypeNormal()) {
24 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME; 26 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
27 if (browser_view_->IsActive())
28 background = rb.GetBitmapNamed(IDR_FRAME);
29 else
30 background = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE);
25 } else { 31 } else {
26 image_name = browser->profile()->IsOffTheRecord() ? 32 Profile* profile = browser_view_->browser()->profile();
27 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE; 33 ThemeProvider* theme = profile->GetThemeProvider();
34 if (browser_view_->IsActive()) {
35 background = theme->GetBitmapNamed(
36 profile->IsOffTheRecord() ?
37 IDR_THEME_FRAME_INCOGNITO : IDR_THEME_FRAME);
38 } else {
39 background = theme->GetBitmapNamed(
40 profile->IsOffTheRecord() ?
41 IDR_THEME_FRAME_INCOGNITO_INACTIVE : IDR_THEME_FRAME_INACTIVE);
42 }
28 } 43 }
29 ThemeProvider* theme = browser->profile()->GetThemeProvider();
30 SkBitmap* background = theme->GetBitmapNamed(image_name);
31 44
32 gfx::Point origin(0, 0); 45 gfx::Point origin(0, 0);
33 views::View::ConvertPointToView(view, 46 views::View::ConvertPointToView(view,
34 browser_view_->frame()->GetFrameView(), 47 browser_view_->frame()->GetFrameView(),
35 &origin); 48 &origin);
36 #if defined(OS_CHROMEOS) 49 #if defined(OS_CHROMEOS)
37 const int kCustomFrameBackgroundVerticalOffset = 15; 50 const int kCustomFrameBackgroundVerticalOffset = 15;
38 // TODO(oshima): Remove this once we fully migrated to views. 51 // TODO(oshima): Remove this once we fully migrated to views.
39 // See http://crbug.com/28580. 52 // See http://crbug.com/28580.
40 if (browser_view_->IsMaximized()) { 53 if (browser_view_->IsMaximized()) {
41 origin.Offset(0, kCustomFrameBackgroundVerticalOffset + 1); 54 origin.Offset(0, kCustomFrameBackgroundVerticalOffset + 1);
42 } 55 }
43 #endif 56 #endif
44 canvas->TileImageInt(*background, 57 canvas->TileImageInt(*background,
45 origin.x(), origin.y(), 0, 0, 58 origin.x(), origin.y(), 0, 0,
46 view->width(), view->height()); 59 view->width(), view->height());
47 } 60 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698