summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-17 00:12:08 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-17 00:12:08 +0000
commitcbd5695bd3ebcf288ced5e6afeea61fdf227ffb0 (patch)
tree7d1a5902e82488249cf549b550c7df8bae7c0048 /chrome
parent608a1ee877776d5c4c0c239c2ab1867a1a7c61b3 (diff)
downloadchromium_src-cbd5695bd3ebcf288ced5e6afeea61fdf227ffb0.zip
chromium_src-cbd5695bd3ebcf288ced5e6afeea61fdf227ffb0.tar.gz
chromium_src-cbd5695bd3ebcf288ced5e6afeea61fdf227ffb0.tar.bz2
Revert this earlier fix since it didn't do any good.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2292 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc47
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.h14
2 files changed, 28 insertions, 33 deletions
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc
index 751b4b6..7fdbe04 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -302,6 +302,10 @@ ChromeFont OTRActiveWindowResources::title_font_;
SkBitmap* OTRInactiveWindowResources::standard_frame_bitmaps_[];
ChromeFont OTRInactiveWindowResources::title_font_;
+WindowResources* OpaqueNonClientView::active_resources_ = NULL;
+WindowResources* OpaqueNonClientView::inactive_resources_ = NULL;
+WindowResources* OpaqueNonClientView::active_otr_resources_ = NULL;
+WindowResources* OpaqueNonClientView::inactive_otr_resources_ = NULL;
SkBitmap OpaqueNonClientView::distributor_logo_;
// The distance between the top of the window and the top of the window
@@ -377,12 +381,22 @@ OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame,
close_button_(new ChromeViews::Button),
window_icon_(new TabIconView(this)),
frame_(frame),
- browser_view_(browser_view),
- current_active_resources_(NULL),
- current_inactive_resources_(NULL) {
+ browser_view_(browser_view) {
InitClass();
+ if (browser_view->IsOffTheRecord()) {
+ if (!active_otr_resources_) {
+ // Lazy load OTR resources only when we first show an OTR frame.
+ active_otr_resources_ = new OTRActiveWindowResources;
+ inactive_otr_resources_ = new OTRInactiveWindowResources;
+ }
+ current_active_resources_ = active_otr_resources_;
+ current_inactive_resources_= inactive_otr_resources_;
+ } else {
+ current_active_resources_ = active_resources_;
+ current_inactive_resources_ = inactive_resources_;
+ }
- WindowResources* resources = GetActiveResources();
+ WindowResources* resources = current_active_resources_;
minimize_button_->SetImage(
ChromeViews::Button::BS_NORMAL,
resources->GetPartBitmap(FRAME_MINIMIZE_BUTTON_ICON));
@@ -1019,32 +1033,13 @@ void OpaqueNonClientView::LayoutClientView() {
frame_->client_view()->SetBounds(client_bounds.ToRECT());
}
-WindowResources* OpaqueNonClientView::GetActiveResources() const {
- if (!current_active_resources_) {
- if (browser_view_->IsOffTheRecord()) {
- current_active_resources_ = new OTRActiveWindowResources;
- } else {
- current_active_resources_ = new ActiveWindowResources;
- }
- }
- return current_active_resources_;
-}
-
-WindowResources* OpaqueNonClientView::GetInactiveResources() const {
- if (!current_inactive_resources_) {
- if (browser_view_->IsOffTheRecord()) {
- current_inactive_resources_ = new OTRInactiveWindowResources;
- } else {
- current_inactive_resources_ = new InactiveWindowResources;
- }
- }
- return current_inactive_resources_;
-}
-
// static
void OpaqueNonClientView::InitClass() {
static bool initialized = false;
if (!initialized) {
+ active_resources_ = new ActiveWindowResources;
+ inactive_resources_ = new InactiveWindowResources;
+
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
SkBitmap* image = rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT);
if (!image->isNull())
diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h
index 0387798..e684d81 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.h
+++ b/chrome/browser/views/frame/opaque_non_client_view.h
@@ -92,14 +92,10 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
void LayoutClientView();
// Returns the set of resources to use to paint this view.
- // TODO(beng): Make this conform to Google-style if this trick works.
WindowResources* resources() const {
return frame_->is_active() || paint_as_active() ?
- GetActiveResources() : GetInactiveResources();
+ current_active_resources_ : current_inactive_resources_;
}
-
- inline WindowResources* GetActiveResources() const;
- inline WindowResources* GetInactiveResources() const;
// The layout rect of the title, if visible.
gfx::Rect title_bounds_;
@@ -126,14 +122,18 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
BrowserView2* browser_view_;
// The resources currently used to paint this view.
- mutable WindowResources* current_active_resources_;
- mutable WindowResources* current_inactive_resources_;
+ WindowResources* current_active_resources_;
+ WindowResources* current_inactive_resources_;
// The accessible name of this view.
std::wstring accessible_name_;
static void InitClass();
static SkBitmap distributor_logo_;
+ static WindowResources* active_resources_;
+ static WindowResources* inactive_resources_;
+ static WindowResources* active_otr_resources_;
+ static WindowResources* inactive_otr_resources_;
DISALLOW_EVIL_CONSTRUCTORS(OpaqueNonClientView);
};