summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-09 00:38:19 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-09 00:38:19 +0000
commitb519281d42b82e787e4ba0cb31f3d6cc91c954d3 (patch)
treefb077507c27d1b35b46e14ae99cd5edfe1195e20 /chrome/browser/views
parent3cde1db6f69ce6c03e752cc86bbadf9379259fb2 (diff)
downloadchromium_src-b519281d42b82e787e4ba0cb31f3d6cc91c954d3.zip
chromium_src-b519281d42b82e787e4ba0cb31f3d6cc91c954d3.tar.gz
chromium_src-b519281d42b82e787e4ba0cb31f3d6cc91c954d3.tar.bz2
Even more tweaks.
- make window icon and title work on app windows - make window title updating sync with the task bar - make Aero Glass frame respect app mode settings - move title formatting routine from TabRenderer into Browser (a more central location) - appearance adjustments for app windows with info bars git-svn-id: svn://svn.chromium.org/chrome/trunk/src@612 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.cc8
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.h4
-rw-r--r--chrome/browser/views/frame/browser_view2.cc21
-rw-r--r--chrome/browser/views/frame/browser_view2.h6
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc23
5 files changed, 51 insertions, 11 deletions
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc
index 410e254..96e89f1 100644
--- a/chrome/browser/views/frame/aero_glass_frame.cc
+++ b/chrome/browser/views/frame/aero_glass_frame.cc
@@ -66,6 +66,14 @@ void AeroGlassFrame::Init(const gfx::Rect& bounds) {
Window::Init(NULL, bounds);
}
+bool AeroGlassFrame::IsTabStripVisible() const {
+ return browser_view_->IsTabStripVisible();
+}
+
+bool AeroGlassFrame::IsToolbarVisible() const {
+ return browser_view_->IsToolbarVisible();
+}
+
gfx::Rect AeroGlassFrame::GetToolbarBounds() const {
return browser_view_->GetToolbarBounds();
}
diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h
index e8f298e..a08581c 100644
--- a/chrome/browser/views/frame/aero_glass_frame.h
+++ b/chrome/browser/views/frame/aero_glass_frame.h
@@ -51,8 +51,8 @@ class AeroGlassFrame : public BrowserFrame,
void Init(const gfx::Rect& bounds);
- bool IsToolbarVisible() const { return true; }
- bool IsTabStripVisible() const { return true; }
+ bool IsToolbarVisible() const;
+ bool IsTabStripVisible() const;
// Returns bounds of various areas within the BrowserView ClientView.
gfx::Rect GetToolbarBounds() const;
diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc
index 518134b..7163686 100644
--- a/chrome/browser/views/frame/browser_view2.cc
+++ b/chrome/browser/views/frame/browser_view2.cc
@@ -29,6 +29,7 @@
#include "chrome/browser/views/frame/browser_view2.h"
+#include "chrome/app/theme/theme_resources.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/tab_contents_container_view.h"
@@ -41,9 +42,11 @@
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/resource_bundle.h"
#include "generated_resources.h"
// static
+SkBitmap BrowserView2::default_favicon_;
static const int kToolbarTabStripVerticalOverlap = 3;
static const int kTabShadowSize = 2;
static const int kStatusBubbleHeight = 20;
@@ -64,6 +67,7 @@ BrowserView2::BrowserView2(Browser* browser)
toolbar_(NULL),
contents_container_(NULL),
initialized_(false) {
+ InitClass();
show_bookmark_bar_pref_.Init(prefs::kShowBookmarkBar,
browser_->profile()->GetPrefs(), this);
browser_->tabstrip_model()->AddObserver(this);
@@ -451,7 +455,7 @@ bool BrowserView2::IsModal() const {
}
std::wstring BrowserView2::GetWindowTitle() const {
- return L"Magic browzR";
+ return browser_->GetCurrentPageTitle();
}
ChromeViews::View* BrowserView2::GetInitiallyFocusedView() const {
@@ -463,7 +467,10 @@ bool BrowserView2::ShouldShowWindowTitle() const {
}
SkBitmap BrowserView2::GetWindowIcon() {
- return SkBitmap();
+ SkBitmap favicon = browser_->GetCurrentPageIcon();
+ if (favicon.isNull())
+ return default_favicon_;
+ return favicon;
}
bool BrowserView2::ShouldShowWindowIcon() const {
@@ -836,3 +843,13 @@ void BrowserView2::LoadAccelerators() {
// We don't need the Windows accelerator table anymore.
free(accelerators);
}
+
+// static
+void BrowserView2::InitClass() {
+ static bool initialized = false;
+ if (!initialized) {
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+ default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
+ initialized = true;
+ }
+}
diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h
index 3a7fdec..164451c 100644
--- a/chrome/browser/views/frame/browser_view2.h
+++ b/chrome/browser/views/frame/browser_view2.h
@@ -245,6 +245,9 @@ class BrowserView2 : public BrowserWindow,
// use.
void LoadAccelerators();
+ // Initialize class statics.
+ static void InitClass();
+
// The BrowserFrame that hosts this view.
BrowserFrame* frame_;
@@ -280,6 +283,9 @@ class BrowserView2 : public BrowserWindow,
// True if we have already been initialized.
bool initialized_;
+ // The default favicon image.
+ static SkBitmap default_favicon_;
+
DISALLOW_EVIL_CONSTRUCTORS(BrowserView2);
};
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc
index a64ebdf..823014c 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -631,6 +631,16 @@ void OpaqueNonClientView::EnableClose(bool enable) {
// OpaqueNonClientView, ChromeViews::View overrides:
void OpaqueNonClientView::Paint(ChromeCanvas* canvas) {
+ // Clip the content area out of the rendering.
+ gfx::Rect contents_bounds = frame_->GetContentsBounds();
+ SkRect clip;
+ clip.set(SkIntToScalar(contents_bounds.x()),
+ SkIntToScalar(contents_bounds.y()),
+ SkIntToScalar(contents_bounds.right()),
+ SkIntToScalar(contents_bounds.bottom()));
+ canvas->clipRect(clip, SkRegion::kDifference_Op);
+
+ // Render the remaining portions of the non-client area.
if (frame_->IsMaximized()) {
PaintMaximizedFrameBorder(canvas);
} else {
@@ -640,11 +650,6 @@ void OpaqueNonClientView::Paint(ChromeCanvas* canvas) {
PaintTitleBar(canvas);
PaintToolbarBackground(canvas);
PaintClientEdge(canvas);
-
- // TODO(beng): remove this
- gfx::Rect contents_bounds = frame_->GetContentsBounds();
- canvas->FillRectInt(SK_ColorRED, contents_bounds.x(), contents_bounds.y(),
- contents_bounds.width(), contents_bounds.height());
}
void OpaqueNonClientView::Layout() {
@@ -834,12 +839,16 @@ void OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) {
gfx::Rect client_area_bounds = frame_->GetContentsBounds();
// For some reason things don't line up quite right, so we add and subtract
// pixels here and there for aesthetic bliss.
+ // Enlarge the client area to include the toolbar, since the top edge of
+ // the client area is the toolbar background and the client edge renders
+ // the left and right sides of the toolbar background.
+ int fudge = frame_->window_delegate()->ShouldShowWindowTitle() ? 0 : 1;
client_area_bounds.SetRect(
client_area_bounds.x(),
- frame_->client_view()->GetY() + toolbar_bounds.bottom() - 1,
+ frame_->client_view()->GetY() + toolbar_bounds.bottom() - fudge,
client_area_bounds.width(),
std::max(0, GetHeight() - frame_->client_view()->GetY() -
- toolbar_bounds.bottom() + 1 - kWindowVerticalBorderBottomSize));
+ toolbar_bounds.bottom() + fudge - kWindowVerticalBorderBottomSize));
canvas->TileImageInt(*right, client_area_bounds.right(),
client_area_bounds.y() + 1,