diff options
-rw-r--r-- | chrome/browser/views/browser_views.vcproj | 8 | ||||
-rw-r--r-- | chrome/browser/views/constrained_window_impl.cc | 14 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_non_client_view.cc | 8 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 47 | ||||
-rw-r--r-- | chrome/browser/views/window_resources.cc | 27 | ||||
-rw-r--r-- | chrome/browser/views/window_resources.h | 35 | ||||
-rw-r--r-- | chrome/views/custom_frame_window.cc | 17 |
7 files changed, 84 insertions, 72 deletions
diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj index 1ff0c1d2..1b4f0d0 100644 --- a/chrome/browser/views/browser_views.vcproj +++ b/chrome/browser/views/browser_views.vcproj @@ -669,6 +669,14 @@ RelativePath=".\toolbar_view.h" > </File> + <File + RelativePath=".\window_resources.cc" + > + </File> + <File + RelativePath=".\window_resources.h" + > + </File> </Files> <Globals> </Globals> diff --git a/chrome/browser/views/constrained_window_impl.cc b/chrome/browser/views/constrained_window_impl.cc index 3d0b0c3..85d9e58 100644 --- a/chrome/browser/views/constrained_window_impl.cc +++ b/chrome/browser/views/constrained_window_impl.cc @@ -10,6 +10,7 @@ #include "chrome/browser/tab_contents.h" #include "chrome/browser/views/constrained_window_animation.h" #include "chrome/browser/views/location_bar_view.h" +#include "chrome/browser/views/window_resources.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profile.h" #include "chrome/browser/toolbar_model.h" @@ -40,11 +41,8 @@ namespace ChromeViews { class ClientView; } -//////////////////////////////////////////////////////////////////////////////// -// WindowResources - // An enumeration of bitmap resources used by this window. -enum FramePartBitmap { +enum { FRAME_PART_BITMAP_FIRST = 0, // Must be first. FRAME_BOTTOM_CENTER, @@ -82,14 +80,6 @@ static const int kOTRFramePartIDs[] = { IDR_WINDOW_TOP_LEFT_CORNER_OTR, IDR_WINDOW_TOP_RIGHT_CORNER_OTR, IDR_CLOSE_SA, IDR_CLOSE_SA_H, IDR_CLOSE_SA_P, 0 }; -class WindowResources { - public: - virtual ~WindowResources() {} - virtual SkBitmap* GetPartBitmap(FramePartBitmap part_id) const = 0; - virtual const ChromeFont& GetTitleFont() const = 0; - virtual SkColor GetTitleColor() const = 0; -}; - class XPWindowResources : public WindowResources { public: XPWindowResources() { diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index a13f6ed..4648484 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -7,6 +7,7 @@ #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/tabs/tab_strip.h" #include "chrome/browser/views/frame/browser_view2.h" +#include "chrome/browser/views/window_resources.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/gfx/path.h" @@ -14,12 +15,9 @@ #include "chrome/views/client_view.h" #include "chrome/views/window_delegate.h" -/////////////////////////////////////////////////////////////////////////////// -// WindowResources -// // An enumeration of bitmap resources used by this window. -enum FramePartBitmap { - FRAME_PART_BITMAP_FIRST = 0, // must be first. +enum { + FRAME_PART_BITMAP_FIRST = 0, // must be first. // Client Edge Border. FRAME_CLIENT_EDGE_TOP_LEFT, diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index 86691d2..be7b36a 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -7,18 +7,15 @@ #include "chrome/app/theme/theme_resources.h" #include "chrome/browser/tabs/tab_strip.h" #include "chrome/browser/views/frame/browser_view2.h" -#include "chrome/common/gfx/chrome_canvas.h" +#include "chrome/browser/views/window_resources.h" #include "chrome/common/gfx/chrome_font.h" #include "chrome/common/gfx/path.h" #include "chrome/common/resource_bundle.h" -#include "chrome/views/client_view.h" -/////////////////////////////////////////////////////////////////////////////// -// WindowResources -// + // An enumeration of bitmap resources used by this window. -enum FramePartBitmap { - FRAME_PART_BITMAP_FIRST = 0, // must be first. +enum { + FRAME_PART_BITMAP_FIRST = 0, // Must be first. // Window Controls. FRAME_CLOSE_BUTTON_ICON, @@ -64,40 +61,6 @@ enum FramePartBitmap { FRAME_PART_BITMAP_COUNT // Must be last. }; -class WindowResources { - public: - virtual SkBitmap* GetPartBitmap(FramePartBitmap part) const = 0; - virtual const ChromeFont& GetTitleFont() const = 0; - SkColor title_color() const { return SK_ColorWHITE; } - - SkBitmap app_top_left() const { return app_top_left_; } - SkBitmap app_top_center() const { return app_top_center_; } - SkBitmap app_top_right() const { return app_top_right_; } - - protected: - static void InitClass() { - static bool initialized = false; - if (!initialized) { - ResourceBundle& rb = ResourceBundle::GetSharedInstance(); - app_top_left_ = *rb.GetBitmapNamed(IDR_APP_TOP_LEFT); - app_top_center_ = *rb.GetBitmapNamed(IDR_APP_TOP_CENTER); - app_top_right_ = *rb.GetBitmapNamed(IDR_APP_TOP_RIGHT); - initialized = true; - } - } - - private: - // Bitmaps shared between all frame types. - static SkBitmap app_top_left_; - static SkBitmap app_top_center_; - static SkBitmap app_top_right_; -}; - -// static -SkBitmap WindowResources::app_top_left_; -SkBitmap WindowResources::app_top_center_; -SkBitmap WindowResources::app_top_right_; - class ActiveWindowResources : public WindowResources { public: ActiveWindowResources() { @@ -802,7 +765,7 @@ void OpaqueNonClientView::PaintTitleBar(ChromeCanvas* canvas) { if (d->ShouldShowWindowTitle()) { canvas->DrawStringInt(d->GetWindowTitle(), resources()->GetTitleFont(), - resources()->title_color(), title_bounds_.x(), + resources()->GetTitleColor(), title_bounds_.x(), title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); } diff --git a/chrome/browser/views/window_resources.cc b/chrome/browser/views/window_resources.cc new file mode 100644 index 0000000..42b1bc4 --- /dev/null +++ b/chrome/browser/views/window_resources.cc @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/views/window_resources.h" + +#include "chrome/app/theme/theme_resources.h" +#include "chrome/common/resource_bundle.h" + +#include "SkBitmap.h" + +// static +SkBitmap WindowResources::app_top_left_; +SkBitmap WindowResources::app_top_center_; +SkBitmap WindowResources::app_top_right_; + +// static +void WindowResources::InitClass() { + static bool initialized = false; + if (!initialized) { + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + app_top_left_ = *rb.GetBitmapNamed(IDR_APP_TOP_LEFT); + app_top_center_ = *rb.GetBitmapNamed(IDR_APP_TOP_CENTER); + app_top_right_ = *rb.GetBitmapNamed(IDR_APP_TOP_RIGHT); + initialized = true; + } +} diff --git a/chrome/browser/views/window_resources.h b/chrome/browser/views/window_resources.h new file mode 100644 index 0000000..eeea313 --- /dev/null +++ b/chrome/browser/views/window_resources.h @@ -0,0 +1,35 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_VIEWS_WINDOW_RESOURCES_H_ +#define CHROME_BROWSER_VIEWS_WINDOW_RESOURCES_H_ + +#include "SkBitmap.h" + +class ChromeFont; + +typedef int FramePartBitmap; + +class WindowResources { + public: + virtual ~WindowResources() { } + virtual SkBitmap* GetPartBitmap(FramePartBitmap part) const = 0; + virtual const ChromeFont& GetTitleFont() const = 0; + virtual SkColor GetTitleColor() const { return SK_ColorWHITE; } + + SkBitmap app_top_left() const { return app_top_left_; } + SkBitmap app_top_center() const { return app_top_center_; } + SkBitmap app_top_right() const { return app_top_right_; } + + protected: + static void InitClass(); + + private: + // Bitmaps shared between all frame types. + static SkBitmap app_top_left_; + static SkBitmap app_top_center_; + static SkBitmap app_top_right_; +}; + +#endif // CHROME_BROWSER_VIEWS_WINDOW_RESOURCES_H_ diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 1842953..2f00a88 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -7,6 +7,7 @@ #include "base/gfx/point.h" #include "base/gfx/size.h" #include "chrome/app/theme/theme_resources.h" +#include "chrome/browser/views/window_resources.h" #include "chrome/common/gfx/path.h" #include "chrome/common/gfx/chrome_canvas.h" #include "chrome/common/gfx/chrome_font.h" @@ -25,12 +26,9 @@ namespace ChromeViews { HCURSOR CustomFrameWindow::resize_cursors_[6]; -/////////////////////////////////////////////////////////////////////////////// -// WindowResources -// // An enumeration of bitmap resources used by this window. -enum FramePartBitmap { - FRAME_PART_BITMAP_FIRST = 0, // must be first. +enum { + FRAME_PART_BITMAP_FIRST = 0, // Must be first. // Window Controls. FRAME_CLOSE_BUTTON_ICON, @@ -72,13 +70,6 @@ enum FramePartBitmap { FRAME_PART_BITMAP_COUNT // Must be last. }; -class WindowResources { - public: - virtual SkBitmap* GetPartBitmap(FramePartBitmap part) const = 0; - virtual const ChromeFont& GetTitleFont() const = 0; - SkColor title_color() const { return SK_ColorWHITE; } -}; - class ActiveWindowResources : public WindowResources { public: ActiveWindowResources() { @@ -484,7 +475,7 @@ void DefaultNonClientView::Paint(ChromeCanvas* canvas) { if (d->ShouldShowWindowTitle()) { canvas->DrawStringInt(d->GetWindowTitle(), resources()->GetTitleFont(), - resources()->title_color(), title_bounds_.x(), + resources()->GetTitleColor(), title_bounds_.x(), title_bounds_.y(), title_bounds_.width(), title_bounds_.height()); } |