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

Side by Side Diff: chrome/browser/views/frame/opaque_browser_frame_view.cc

Issue 164379: Merge 22783 - Ensure that popups windows are not themed.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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/views/frame/browser_frame_win.cc ('k') | views/window/non_client_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/chrome/browser/views/frame/opaque_browser_frame_view.cc:r22783
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/frame/opaque_browser_frame_view.h" 5 #include "chrome/browser/views/frame/opaque_browser_frame_view.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/gfx/font.h" 8 #include "app/gfx/font.h"
9 #include "app/gfx/path.h" 9 #include "app/gfx/path.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 close_button_(new views::ImageButton(this))), 118 close_button_(new views::ImageButton(this))),
119 window_icon_(NULL), 119 window_icon_(NULL),
120 frame_(frame), 120 frame_(frame),
121 browser_view_(browser_view) { 121 browser_view_(browser_view) {
122 InitClass(); 122 InitClass();
123 123
124 ThemeProvider* tp = frame_->GetThemeProviderForFrame(); 124 ThemeProvider* tp = frame_->GetThemeProviderForFrame();
125 SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND); 125 SkColor color = tp->GetColor(BrowserThemeProvider::COLOR_BUTTON_BACKGROUND);
126 SkBitmap* background = 126 SkBitmap* background =
127 tp->GetBitmapNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND); 127 tp->GetBitmapNamed(IDR_THEME_WINDOW_CONTROL_BACKGROUND);
128
129 minimize_button_->SetImage( 128 minimize_button_->SetImage(
130 views::CustomButton::BS_NORMAL, 129 views::CustomButton::BS_NORMAL,
131 tp->GetBitmapNamed(IDR_MINIMIZE)); 130 tp->GetBitmapNamed(IDR_MINIMIZE));
132 minimize_button_->SetImage( 131 minimize_button_->SetImage(
133 views::CustomButton::BS_HOT, 132 views::CustomButton::BS_HOT,
134 tp->GetBitmapNamed(IDR_MINIMIZE_H)); 133 tp->GetBitmapNamed(IDR_MINIMIZE_H));
135 minimize_button_->SetImage( 134 minimize_button_->SetImage(
136 views::CustomButton::BS_PUSHED, 135 views::CustomButton::BS_PUSHED,
137 tp->GetBitmapNamed(IDR_MINIMIZE_P)); 136 tp->GetBitmapNamed(IDR_MINIMIZE_P));
138 minimize_button_->SetBackground(color, background, 137 if (browser_view_->IsBrowserTypeNormal())
139 tp->GetBitmapNamed(IDR_MINIMIZE_BUTTON_MASK)); 138 minimize_button_->SetBackground(color, background,
139 tp->GetBitmapNamed(IDR_MINIMIZE_BUTTON_MASK));
140 minimize_button_->SetAccessibleName( 140 minimize_button_->SetAccessibleName(
141 l10n_util::GetString(IDS_ACCNAME_MINIMIZE)); 141 l10n_util::GetString(IDS_ACCNAME_MINIMIZE));
142 AddChildView(minimize_button_); 142 AddChildView(minimize_button_);
143 143
144 maximize_button_->SetImage( 144 maximize_button_->SetImage(
145 views::CustomButton::BS_NORMAL, 145 views::CustomButton::BS_NORMAL,
146 tp->GetBitmapNamed(IDR_MAXIMIZE)); 146 tp->GetBitmapNamed(IDR_MAXIMIZE));
147 maximize_button_->SetImage( 147 maximize_button_->SetImage(
148 views::CustomButton::BS_HOT, 148 views::CustomButton::BS_HOT,
149 tp->GetBitmapNamed(IDR_MAXIMIZE_H)); 149 tp->GetBitmapNamed(IDR_MAXIMIZE_H));
150 maximize_button_->SetImage( 150 maximize_button_->SetImage(
151 views::CustomButton::BS_PUSHED, 151 views::CustomButton::BS_PUSHED,
152 tp->GetBitmapNamed(IDR_MAXIMIZE_P)); 152 tp->GetBitmapNamed(IDR_MAXIMIZE_P));
153 maximize_button_->SetBackground(color, background, 153 if (browser_view_->IsBrowserTypeNormal())
154 tp->GetBitmapNamed(IDR_MAXIMIZE_BUTTON_MASK)); 154 maximize_button_->SetBackground(color, background,
155 tp->GetBitmapNamed(IDR_MAXIMIZE_BUTTON_MASK));
155 maximize_button_->SetAccessibleName( 156 maximize_button_->SetAccessibleName(
156 l10n_util::GetString(IDS_ACCNAME_MAXIMIZE)); 157 l10n_util::GetString(IDS_ACCNAME_MAXIMIZE));
157 AddChildView(maximize_button_); 158 AddChildView(maximize_button_);
158 159
159 restore_button_->SetImage( 160 restore_button_->SetImage(
160 views::CustomButton::BS_NORMAL, 161 views::CustomButton::BS_NORMAL,
161 tp->GetBitmapNamed(IDR_RESTORE)); 162 tp->GetBitmapNamed(IDR_RESTORE));
162 restore_button_->SetImage( 163 restore_button_->SetImage(
163 views::CustomButton::BS_HOT, 164 views::CustomButton::BS_HOT,
164 tp->GetBitmapNamed(IDR_RESTORE_H)); 165 tp->GetBitmapNamed(IDR_RESTORE_H));
165 restore_button_->SetImage( 166 restore_button_->SetImage(
166 views::CustomButton::BS_PUSHED, 167 views::CustomButton::BS_PUSHED,
167 tp->GetBitmapNamed(IDR_RESTORE_P)); 168 tp->GetBitmapNamed(IDR_RESTORE_P));
168 restore_button_->SetBackground(color, background, 169 if (browser_view_->IsBrowserTypeNormal())
169 tp->GetBitmapNamed(IDR_RESTORE_BUTTON_MASK)); 170 restore_button_->SetBackground(color, background,
171 tp->GetBitmapNamed(IDR_RESTORE_BUTTON_MASK));
170 restore_button_->SetAccessibleName( 172 restore_button_->SetAccessibleName(
171 l10n_util::GetString(IDS_ACCNAME_RESTORE)); 173 l10n_util::GetString(IDS_ACCNAME_RESTORE));
172 AddChildView(restore_button_); 174 AddChildView(restore_button_);
173 175
174 close_button_->SetImage( 176 close_button_->SetImage(
175 views::CustomButton::BS_NORMAL, 177 views::CustomButton::BS_NORMAL,
176 tp->GetBitmapNamed(IDR_CLOSE)); 178 tp->GetBitmapNamed(IDR_CLOSE));
177 close_button_->SetImage( 179 close_button_->SetImage(
178 views::CustomButton::BS_HOT, 180 views::CustomButton::BS_HOT,
179 tp->GetBitmapNamed(IDR_CLOSE_H)); 181 tp->GetBitmapNamed(IDR_CLOSE_H));
180 close_button_->SetImage( 182 close_button_->SetImage(
181 views::CustomButton::BS_PUSHED, 183 views::CustomButton::BS_PUSHED,
182 tp->GetBitmapNamed(IDR_CLOSE_P)); 184 tp->GetBitmapNamed(IDR_CLOSE_P));
183 close_button_->SetBackground(color, background, 185 if (browser_view_->IsBrowserTypeNormal())
184 tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK)); 186 close_button_->SetBackground(color, background,
187 tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK));
185 close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE)); 188 close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
186 AddChildView(close_button_); 189 AddChildView(close_button_);
187 190
188 // Initializing the TabIconView is expensive, so only do it if we need to. 191 // Initializing the TabIconView is expensive, so only do it if we need to.
189 if (browser_view_->ShouldShowWindowIcon()) { 192 if (browser_view_->ShouldShowWindowIcon()) {
190 window_icon_ = new TabIconView(this); 193 window_icon_ = new TabIconView(this);
191 window_icon_->set_is_light(true); 194 window_icon_->set_is_light(true);
192 AddChildView(window_icon_); 195 AddChildView(window_icon_);
193 window_icon_->Update(); 196 window_icon_->Update();
194 } 197 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 SkBitmap* bottom_left_corner = 556 SkBitmap* bottom_left_corner =
554 tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER); 557 tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER);
555 SkBitmap* bottom_right_corner = 558 SkBitmap* bottom_right_corner =
556 tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER); 559 tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER);
557 SkBitmap* bottom_edge = tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER); 560 SkBitmap* bottom_edge = tp->GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER);
558 561
559 562
560 // Window frame mode and color 563 // Window frame mode and color
561 SkBitmap* theme_frame; 564 SkBitmap* theme_frame;
562 SkColor frame_color; 565 SkColor frame_color;
563 if (!browser_view_->IsOffTheRecord()) { 566
567 // Never theme app and popup windows.
568 if (!browser_view_->IsBrowserTypeNormal()) {
569 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
570 if (frame_->GetWindow()->IsActive()) {
571 theme_frame = rb.GetBitmapNamed(IDR_FRAME);
572 frame_color = browser_view_->IsOffTheRecord() ?
573 ResourceBundle::frame_color_incognito :
574 ResourceBundle::frame_color;
575 } else {
576 theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE);
577 frame_color = browser_view_->IsOffTheRecord() ?
578 ResourceBundle::frame_color_incognito_inactive :
579 ResourceBundle::frame_color_inactive;
580 }
581 } else if (!browser_view_->IsOffTheRecord()) {
564 if (frame_->GetWindow()->IsActive()) { 582 if (frame_->GetWindow()->IsActive()) {
565 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME); 583 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME);
566 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME); 584 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME);
567 } else { 585 } else {
568 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); 586 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE);
569 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME_INACTIVE); 587 frame_color = tp->GetColor(BrowserThemeProvider::COLOR_FRAME_INACTIVE);
570 } 588 }
571 } else { 589 } else {
572 if (frame_->GetWindow()->IsActive()) { 590 if (frame_->GetWindow()->IsActive()) {
573 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO); 591 theme_frame = tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO);
(...skipping 18 matching lines...) Expand all
592 // Now fill the bottom area. 610 // Now fill the bottom area.
593 canvas->FillRectInt(frame_color, 611 canvas->FillRectInt(frame_color,
594 left_edge->width(), height() - bottom_edge->height(), 612 left_edge->width(), height() - bottom_edge->height(),
595 width() - left_edge->width() - right_edge->width(), 613 width() - left_edge->width() - right_edge->width(),
596 bottom_edge->height()); 614 bottom_edge->height());
597 615
598 // Draw the theme frame. 616 // Draw the theme frame.
599 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); 617 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height());
600 618
601 // Draw the theme frame overlay 619 // Draw the theme frame overlay
602 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY)) { 620 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
621 browser_view_->IsBrowserTypeNormal()) {
603 SkBitmap* theme_overlay; 622 SkBitmap* theme_overlay;
604 if (frame_->GetWindow()->IsActive()) 623 if (frame_->GetWindow()->IsActive())
605 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY); 624 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY);
606 else 625 else
607 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE); 626 theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY_INACTIVE);
608 canvas->DrawBitmapInt(*theme_overlay, 0, 0); 627 canvas->DrawBitmapInt(*theme_overlay, 0, 0);
609 } 628 }
610 629
611 // Top. 630 // Top.
612 int top_left_height = std::min(top_left_corner->height(), 631 int top_left_height = std::min(top_left_corner->height(),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 height() - top_left_height - bottom_left_corner->height()); 666 height() - top_left_height - bottom_left_corner->height());
648 } 667 }
649 668
650 669
651 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) { 670 void OpaqueBrowserFrameView::PaintMaximizedFrameBorder(gfx::Canvas* canvas) {
652 ThemeProvider* tp = GetThemeProvider(); 671 ThemeProvider* tp = GetThemeProvider();
653 views::Window* window = frame_->GetWindow(); 672 views::Window* window = frame_->GetWindow();
654 673
655 // Window frame mode and color 674 // Window frame mode and color
656 SkBitmap* theme_frame; 675 SkBitmap* theme_frame;
657 if (!browser_view_->IsOffTheRecord()) { 676
677 // Never theme app and popup windows.
678 if (!browser_view_->IsBrowserTypeNormal()) {
679 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
680 if (frame_->GetWindow()->IsActive())
681 theme_frame = rb.GetBitmapNamed(IDR_FRAME);
682 else
683 theme_frame = rb.GetBitmapNamed(IDR_THEME_FRAME_INACTIVE);
684 } else if (!browser_view_->IsOffTheRecord()) {
658 theme_frame = window->IsActive() ? 685 theme_frame = window->IsActive() ?
659 tp->GetBitmapNamed(IDR_THEME_FRAME) : 686 tp->GetBitmapNamed(IDR_THEME_FRAME) :
660 tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); 687 tp->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE);
661 } else { 688 } else {
662 theme_frame = window->IsActive() ? 689 theme_frame = window->IsActive() ?
663 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO) : 690 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO) :
664 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE); 691 tp->GetBitmapNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE);
665 } 692 }
666 693
667 // Draw the theme frame. 694 // Draw the theme frame.
668 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height()); 695 canvas->TileImageInt(*theme_frame, 0, 0, width(), theme_frame->height());
669 696
670 // Draw the theme frame overlay 697 // Draw the theme frame overlay
671 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY)) { 698 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
699 browser_view_->IsBrowserTypeNormal()) {
672 SkBitmap* theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY); 700 SkBitmap* theme_overlay = tp->GetBitmapNamed(IDR_THEME_FRAME_OVERLAY);
673 canvas->DrawBitmapInt(*theme_overlay, 0, 0); 701 canvas->DrawBitmapInt(*theme_overlay, 0, 0);
674 } 702 }
675 703
676 if (!browser_view_->IsToolbarVisible()) { 704 if (!browser_view_->IsToolbarVisible()) {
677 // There's no toolbar to edge the frame border, so we need to draw a bottom 705 // There's no toolbar to edge the frame border, so we need to draw a bottom
678 // edge. The graphic we use for this has a built in client edge, so we clip 706 // edge. The graphic we use for this has a built in client edge, so we clip
679 // it off the bottom. 707 // it off the bottom.
680 SkBitmap* top_center = 708 SkBitmap* top_center =
681 tp->GetBitmapNamed(IDR_APP_TOP_CENTER); 709 tp->GetBitmapNamed(IDR_APP_TOP_CENTER);
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 if (!initialized) { 1044 if (!initialized) {
1017 #if defined(OS_WIN) 1045 #if defined(OS_WIN)
1018 title_font_ = new gfx::Font(win_util::GetWindowTitleFont()); 1046 title_font_ = new gfx::Font(win_util::GetWindowTitleFont());
1019 #else 1047 #else
1020 NOTIMPLEMENTED(); 1048 NOTIMPLEMENTED();
1021 title_font_ = new gfx::Font(); 1049 title_font_ = new gfx::Font();
1022 #endif 1050 #endif
1023 initialized = true; 1051 initialized = true;
1024 } 1052 }
1025 } 1053 }
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/browser_frame_win.cc ('k') | views/window/non_client_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698