summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 17:46:13 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-08 17:46:13 +0000
commit1b2db1a0c769664ffb0997406e739e8e91da0b32 (patch)
tree4a633b7f473d70e8165439f6d6e4ec80e4469c0b /chrome
parent47572b229b76188daff74cf1571e2f423448c374 (diff)
downloadchromium_src-1b2db1a0c769664ffb0997406e739e8e91da0b32.zip
chromium_src-1b2db1a0c769664ffb0997406e739e8e91da0b32.tar.gz
chromium_src-1b2db1a0c769664ffb0997406e739e8e91da0b32.tar.bz2
Tweaks to make the opaque frame look better including adding support for app windows. Document the constants in the non-client view. Make the OTR frame work. Add a check to browser process that we use to check if we're using the new frames so we can disable various functionality that isn't appropriate.
B=1031854 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc34
-rw-r--r--chrome/browser/browser_process.h3
-rw-r--r--chrome/browser/browser_process_impl.cc4
-rw-r--r--chrome/browser/browser_process_impl.h14
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.cc13
-rw-r--r--chrome/browser/views/frame/aero_glass_frame.h5
-rw-r--r--chrome/browser/views/frame/browser_view2.cc44
-rw-r--r--chrome/browser/views/frame/browser_view2.h8
-rw-r--r--chrome/browser/views/frame/browser_window_factory.cc4
-rw-r--r--chrome/browser/views/frame/opaque_frame.cc3
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc135
11 files changed, 209 insertions, 58 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 23d9f7c..105654f 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -1390,7 +1390,8 @@ void Browser::TabClosingAt(TabContents* contents, int index) {
// Sever the TabContents' connection back to us.
contents->set_delegate(NULL);
- if (contents == GetSelectedTabContents()) {
+ if (!g_browser_process->IsUsingNewFrames() &&
+ contents == GetSelectedTabContents()) {
// We need to reset the current tab contents to NULL before it gets
// freed. This is because the focus manager performs some operation
// on the selected tab contents when it is removed.
@@ -1420,8 +1421,7 @@ void Browser::TabSelectedAt(TabContents* old_contents,
TabContents* new_contents,
int index,
bool user_gesture) {
- if (new_contents == old_contents)
- return;
+ DCHECK(old_contents != new_contents);
// If we have any update pending, do it now.
if (!chrome_updater_factory_.empty() && old_contents)
@@ -1429,8 +1429,10 @@ void Browser::TabSelectedAt(TabContents* old_contents,
LocationBarView* location_bar = GetLocationBarView();
if (old_contents) {
- // Have the contents remember where focus was.
- old_contents->StoreFocus();
+ if (!g_browser_process->IsUsingNewFrames()) {
+ // Have the contents remember where focus was.
+ old_contents->StoreFocus();
+ }
// Save what the user's currently typing, so it can be restored when we
// switch back to this tab.
@@ -1438,13 +1440,15 @@ void Browser::TabSelectedAt(TabContents* old_contents,
location_bar->location_entry()->SaveStateToTab(old_contents);
}
- // Tell the frame what happened so that the TabContents gets resized, etc.
- window_->ShowTabContents(new_contents);
+ if (!g_browser_process->IsUsingNewFrames()) {
+ // Tell the frame what happened so that the TabContents gets resized, etc.
+ window_->ShowTabContents(new_contents);
- // Inform the tab that it is now selected.
- new_contents->DidBecomeSelected();
- if (BrowserList::GetLastActive() == this)
- new_contents->RestoreFocus();
+ // Inform the tab that it is now selected.
+ new_contents->DidBecomeSelected();
+ if (BrowserList::GetLastActive() == this)
+ new_contents->RestoreFocus();
+ }
// Propagate the profile to the location bar.
window_->ProfileChanged(new_contents->profile());
@@ -1489,9 +1493,11 @@ void Browser::TabMoved(TabContents* contents,
}
void Browser::TabStripEmpty() {
- // We need to reset the frame contents just in case this wasn't done while
- // detaching the tab. This happens when dragging out the last tab.
- window_->ShowTabContents(NULL);
+ if (!g_browser_process->IsUsingNewFrames()) {
+ // We need to reset the frame contents just in case this wasn't done while
+ // detaching the tab. This happens when dragging out the last tab.
+ window_->ShowTabContents(NULL);
+ }
// Close the frame after we return to the message loop (not immediately,
// otherwise it will destroy this object before the stack has a chance to
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
index 927ddaa9..1ca493c 100644
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -143,6 +143,9 @@ class BrowserProcess {
virtual SuspendController* suspend_controller() = 0;
+ // TODO(beng): remove once XPFrame/VistaFrame are gone.
+ virtual bool IsUsingNewFrames() = 0;
+
private:
DISALLOW_EVIL_CONSTRUCTORS(BrowserProcess);
};
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 3d5bd99..20e0c37 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -119,7 +119,9 @@ BrowserProcessImpl::BrowserProcessImpl(CommandLine& command_line)
created_debugger_wrapper_(false),
broker_services_(NULL),
module_ref_count_(0),
- memory_model_(MEDIUM_MEMORY_MODEL) {
+ memory_model_(MEDIUM_MEMORY_MODEL),
+ checked_for_new_frames_(false),
+ using_new_frames_(false) {
g_browser_process = this;
clipboard_service_.reset(new ClipboardService);
main_notification_service_.reset(new NotificationService);
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index 726b0c0..3683277 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -38,6 +38,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
@@ -196,6 +197,16 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
return suspend_controller_.get();
}
+ // TODO(beng): remove once XPFrame/VistaFrame are gone.
+ virtual bool IsUsingNewFrames() {
+ DCHECK(CalledOnValidThread());
+ if (!checked_for_new_frames_) {
+ using_new_frames_ = CommandLine().HasSwitch(L"magic_browzR");
+ checked_for_new_frames_ = true;
+ }
+ return using_new_frames_;
+ }
+
private:
void CreateResourceDispatcherHost();
void CreatePrefService();
@@ -267,6 +278,9 @@ class BrowserProcessImpl : public BrowserProcess, public NonThreadSafe {
scoped_refptr<SuspendController> suspend_controller_;
+ bool checked_for_new_frames_;
+ bool using_new_frames_;
+
DISALLOW_EVIL_CONSTRUCTORS(BrowserProcessImpl);
};
diff --git a/chrome/browser/views/frame/aero_glass_frame.cc b/chrome/browser/views/frame/aero_glass_frame.cc
index ea25bcc..410e254 100644
--- a/chrome/browser/views/frame/aero_glass_frame.cc
+++ b/chrome/browser/views/frame/aero_glass_frame.cc
@@ -156,6 +156,19 @@ LRESULT AeroGlassFrame::OnNCHitTest(const CPoint& pt) {
}
///////////////////////////////////////////////////////////////////////////////
+// AeroGlassFrame, ChromeViews::HWNDViewContainer overrides:
+
+bool AeroGlassFrame::AcceleratorPressed(
+ ChromeViews::Accelerator* accelerator) {
+ return browser_view_->AcceleratorPressed(*accelerator);
+}
+
+bool AeroGlassFrame::GetAccelerator(int cmd_id,
+ ChromeViews::Accelerator* accelerator) {
+ return browser_view_->GetAccelerator(cmd_id, accelerator);
+}
+
+///////////////////////////////////////////////////////////////////////////////
// AeroGlassFrame, private:
void AeroGlassFrame::UpdateDWMFrame() {
diff --git a/chrome/browser/views/frame/aero_glass_frame.h b/chrome/browser/views/frame/aero_glass_frame.h
index f2e18a0..e8f298e 100644
--- a/chrome/browser/views/frame/aero_glass_frame.h
+++ b/chrome/browser/views/frame/aero_glass_frame.h
@@ -69,6 +69,11 @@ class AeroGlassFrame : public BrowserFrame,
virtual gfx::Rect GetBoundsForTabStrip(TabStrip* tabstrip) const;
virtual ChromeViews::Window* GetWindow();
+ // Overridden from ChromeViews::HWNDViewContainer:
+ virtual bool AcceleratorPressed(ChromeViews::Accelerator* accelerator);
+ virtual bool GetAccelerator(int cmd_id,
+ ChromeViews::Accelerator* accelerator);
+
protected:
// Overridden from ChromeViews::HWNDViewContainer:
virtual LRESULT OnNCActivate(BOOL active);
diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc
index 8c486c9..2ecafaa 100644
--- a/chrome/browser/views/frame/browser_view2.cc
+++ b/chrome/browser/views/frame/browser_view2.cc
@@ -40,6 +40,7 @@
#include "chrome/browser/views/status_bubble.h"
#include "chrome/browser/views/toolbar_view.h"
#include "chrome/common/l10n_util.h"
+#include "chrome/common/pref_names.h"
#include "generated_resources.h"
// static
@@ -63,19 +64,13 @@ BrowserView2::BrowserView2(Browser* browser)
toolbar_(NULL),
contents_container_(NULL),
initialized_(false) {
- NotificationService::current()->AddObserver(
- this,
- NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources());
+ show_bookmark_bar_pref_.Init(prefs::kShowBookmarkBar,
+ browser_->profile()->GetPrefs(), this);
browser_->tabstrip_model()->AddObserver(this);
}
BrowserView2::~BrowserView2() {
browser_->tabstrip_model()->RemoveObserver(this);
- NotificationService::current()->RemoveObserver(
- this,
- NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
- NotificationService::AllSources());
}
gfx::Rect BrowserView2::GetToolbarBounds() const {
@@ -100,6 +95,10 @@ bool BrowserView2::IsTabStripVisible() const {
return SupportsWindowFeature(FEATURE_TABSTRIP);
}
+bool BrowserView2::IsOffTheRecord() const {
+ return browser_->profile()->IsOffTheRecord();
+}
+
bool BrowserView2::AcceleratorPressed(
const ChromeViews::Accelerator& accelerator) {
DCHECK(accelerator_table_.get());
@@ -366,11 +365,10 @@ void BrowserView2::DestroyBrowser() {
void BrowserView2::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NOTIFY_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) {
- if (browser_->profile() == Source<Profile>(source).ptr() &&
- MaybeShowBookmarkBar(browser_->GetSelectedTabContents())) {
+ if (type == NOTIFY_PREF_CHANGED &&
+ *Details<std::wstring>(details).ptr() == prefs::kShowBookmarkBar) {
+ if (MaybeShowBookmarkBar(browser_->GetSelectedTabContents()))
Layout();
- }
} else {
NOTREACHED() << "Got a notification we didn't register for!";
}
@@ -406,6 +404,8 @@ void BrowserView2::TabSelectedAt(TabContents* old_contents,
TabContents* new_contents,
int index,
bool user_gesture) {
+ DCHECK(old_contents != new_contents);
+
if (old_contents)
old_contents->StoreFocus();
@@ -624,12 +624,14 @@ void BrowserView2::ViewHierarchyChanged(bool is_add,
// BrowserView2, private:
int BrowserView2::LayoutTabStrip() {
- gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_);
- // TODO(beng): account for OTR avatar.
- tabstrip_->SetBounds(tabstrip_bounds.x(), tabstrip_bounds.y(),
- tabstrip_bounds.width(), tabstrip_bounds.height());
- return tabstrip_bounds.bottom();
- // TODO(beng): support tabstrip-less windows.
+ if (IsTabStripVisible()) {
+ gfx::Rect tabstrip_bounds = frame_->GetBoundsForTabStrip(tabstrip_);
+ // TODO(beng): account for OTR avatar.
+ tabstrip_->SetBounds(tabstrip_bounds.x(), tabstrip_bounds.y(),
+ tabstrip_bounds.width(), tabstrip_bounds.height());
+ return tabstrip_bounds.bottom();
+ }
+ return 0;
}
int BrowserView2::LayoutToolbar(int top) {
@@ -676,6 +678,10 @@ int BrowserView2::LayoutInfoBar(int top) {
active_info_bar_->GetPreferredSize(&ps);
active_info_bar_->SetBounds(0, top, GetWidth(), ps.cy);
top += ps.cy;
+ if (SupportsWindowFeature(FEATURE_BOOKMARKBAR) && active_bookmark_bar_ &&
+ !show_bookmark_bar_pref_.GetValue()) {
+ top -= kSeparationLineHeight;
+ }
}
return top;
}
@@ -734,7 +740,7 @@ void BrowserView2::UpdateUIForContents(TabContents* contents) {
if (!contents)
return;
- if (MaybeShowBookmarkBar(contents) && MaybeShowInfoBar(contents) &&
+ if (MaybeShowBookmarkBar(contents) || MaybeShowInfoBar(contents) ||
MaybeShowDownloadShelf(contents)) {
Layout();
}
diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h
index 54e3fa6..3a7fdec 100644
--- a/chrome/browser/views/frame/browser_view2.h
+++ b/chrome/browser/views/frame/browser_view2.h
@@ -34,6 +34,7 @@
#include "chrome/browser/browser_window.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/views/frame/browser_frame.h"
+#include "chrome/common/pref_member.h"
#include "chrome/views/client_view.h"
#include "chrome/views/window_delegate.h"
@@ -74,6 +75,10 @@ class BrowserView2 : public BrowserWindow,
bool IsToolbarVisible() const;
bool IsTabStripVisible() const;
+ // Returns true if the profile associated with this Browser window is
+ // off the record.
+ bool IsOffTheRecord() const;
+
// Handle the specified |accelerator| being pressed.
bool AcceleratorPressed(const ChromeViews::Accelerator& accelerator);
@@ -269,6 +274,9 @@ class BrowserView2 : public BrowserWindow,
// A mapping between accelerators and commands.
scoped_ptr<std::map<ChromeViews::Accelerator, int>> accelerator_table_;
+ // A PrefMember to track the "always show bookmark bar" pref.
+ BooleanPrefMember show_bookmark_bar_pref_;
+
// True if we have already been initialized.
bool initialized_;
diff --git a/chrome/browser/views/frame/browser_window_factory.cc b/chrome/browser/views/frame/browser_window_factory.cc
index 1897ebcf..aa51cd9 100644
--- a/chrome/browser/views/frame/browser_window_factory.cc
+++ b/chrome/browser/views/frame/browser_window_factory.cc
@@ -29,6 +29,7 @@
#include "base/command_line.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_process.h" // TODO(beng): remove once done.
#include "chrome/browser/browser_window.h"
#include "chrome/browser/frame_util.h"
#include "chrome/browser/views/frame/aero_glass_frame.h"
@@ -52,8 +53,7 @@ BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser,
// However BrowserView is the one that Browser has a ref to, and
// calls that BrowserView can't perform directly are passed on to
// its frame. Eventually this will be better, I promise.
- CommandLine parsed_command_line;
- if (parsed_command_line.HasSwitch(L"magic_browzR")) {
+ if (g_browser_process->IsUsingNewFrames()) {
BrowserView2* browser_view = new BrowserView2(browser);
BrowserFrame::CreateForBrowserView(BrowserFrame::GetActiveFrameType(),
browser_view, bounds, show_command);
diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc
index 0d33c45..1d4a46d 100644
--- a/chrome/browser/views/frame/opaque_frame.cc
+++ b/chrome/browser/views/frame/opaque_frame.cc
@@ -38,7 +38,8 @@
// OpaqueFrame, public:
OpaqueFrame::OpaqueFrame(BrowserView2* browser_view)
- : CustomFrameWindow(browser_view, new OpaqueNonClientView(this, false)),
+ : CustomFrameWindow(browser_view, new OpaqueNonClientView(this,
+ browser_view->IsOffTheRecord())),
browser_view_(browser_view) {
browser_view_->set_frame(this);
}
diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc
index 8144580..599380a 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -93,11 +93,41 @@ class WindowResources {
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() { InitClass(); }
+ ActiveWindowResources() {
+ InitClass();
+ WindowResources::InitClass();
+ }
virtual ~ActiveWindowResources() { }
// WindowResources implementation:
@@ -151,7 +181,10 @@ class ActiveWindowResources : public WindowResources {
class InactiveWindowResources : public WindowResources {
public:
- InactiveWindowResources() { InitClass(); }
+ InactiveWindowResources() {
+ InitClass();
+ WindowResources::InitClass();
+ }
virtual ~InactiveWindowResources() { }
// WindowResources implementation:
@@ -205,7 +238,10 @@ class InactiveWindowResources : public WindowResources {
class OTRActiveWindowResources : public WindowResources {
public:
- OTRActiveWindowResources() { InitClass(); }
+ OTRActiveWindowResources() {
+ InitClass();
+ WindowResources::InitClass();
+ }
virtual ~OTRActiveWindowResources() { }
// WindowResources implementation:
@@ -259,7 +295,10 @@ class OTRActiveWindowResources : public WindowResources {
class OTRInactiveWindowResources : public WindowResources {
public:
- OTRInactiveWindowResources() { InitClass(); }
+ OTRInactiveWindowResources() {
+ InitClass();
+ WindowResources::InitClass();
+ }
virtual ~OTRInactiveWindowResources() { }
// WindowResources implementation:
@@ -326,24 +365,61 @@ 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
+// controls when the window is restored.
static const int kWindowControlsTopOffset = 0;
+// The distance between the right edge of the window and the right edge of the
+// right-most window control when the window is restored.
static const int kWindowControlsRightOffset = 4;
-static const int kWindowControlsTopZoomedOffset = 6;
+// The distance between the top of the window and the top of the window
+// controls when the window is maximized.
+static const int kWindowControlsTopZoomedOffset = 4;
+// The distance between the right edge of the window and the right edge of the
+// right-most window control when the window is maximized.
static const int kWindowControlsRightZoomedOffset = 5;
+// The distance between the top of the window and the title bar/tab strip when
+// the window is maximized.
static const int kWindowTopMarginZoomed = 1;
+// The distance between the left edge of the window and the left of the window
+// icon when a title-bar is showing.
static const int kWindowIconLeftOffset = 5;
+// The distance between the top of the window and the top of the window icon
+// when a title-bar is showing.
static const int kWindowIconTopOffset = 5;
-static const int kTitleTopOffset = 6;
+// The distance between the window icon and the window title when a title-bar
+// is showing.
static const int kWindowIconTitleSpacing = 3;
+// The distance between the top of the window and the title text when a
+// title-bar is showing.
+static const int kTitleTopOffset = 6;
+// The distance between the bottom of the title text and the TabStrip when a
+// title-bar is showing.
static const int kTitleBottomSpacing = 6;
+// The distance between the top edge of the window and the TabStrip when there
+// is no title-bar showing, and the window is restored.
static const int kNoTitleTopSpacing = 10;
-static const int kResizeAreaSize = 5;
-static const int kResizeAreaNorthSize = 3;
+// The distance between the top edge of the window and the TabStrip when there
+// is no title-bar showing, and the window is maximized.
+static const int kNoTitleZoomedTopSpacing = 1;
+// The amount of horizontal and vertical distance from a corner of the window
+// within which a mouse-drive resize operation will resize the window in two
+// dimensions.
static const int kResizeAreaCornerSize = 16;
-static const int kWindowHorizontalBorderSize = 4;
-static const int kWindowVerticalBorderSize = 4;
+// The width of the sizing border on the left and right edge of the window.
+static const int kWindowHorizontalBorderSize = 5;
+// The height of the sizing border at the top edge of the window
+static const int kWindowVerticalBorderTopSize = 3;
+// The height of the sizing border on the bottom edge of the window.
+static const int kWindowVerticalBorderBottomSize = 5;
+// The width and height of the window icon that appears at the top left of
+// pop-up and app windows.
static const int kWindowIconSize = 16;
+// The horizontal distance of the right edge of the distributor logo from the
+// left edge of the left-most window control.
static const int kDistributorLogoHorizontalOffset = 7;
+// The vertical distance of the top of the distributor logo from the top edge
+// of the window.
static const int kDistributorLogoVerticalOffset = 3;
///////////////////////////////////////////////////////////////////////////////
@@ -357,6 +433,11 @@ OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame, bool is_otr)
frame_(frame) {
InitClass();
if (is_otr) {
+ 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 {
@@ -426,7 +507,7 @@ gfx::Rect OpaqueNonClientView::GetWindowBoundsForClientBounds(
int window_y = std::max(0, client_bounds.y() - top_height);
int window_w = client_bounds.width() + (2 * kWindowHorizontalBorderSize);
int window_h =
- client_bounds.height() + top_height + kWindowVerticalBorderSize;
+ client_bounds.height() + top_height + kWindowVerticalBorderBottomSize;
return gfx::Rect(window_x, window_y, window_w, window_h);
}
@@ -460,7 +541,7 @@ gfx::Rect OpaqueNonClientView::CalculateClientAreaBounds(int width,
int top_margin = CalculateNonClientTopHeight();
return gfx::Rect(kWindowHorizontalBorderSize, top_margin,
std::max(0, width - (2 * kWindowHorizontalBorderSize)),
- std::max(0, height - top_margin - kWindowVerticalBorderSize));
+ std::max(0, height - top_margin - kWindowVerticalBorderBottomSize));
}
gfx::Size OpaqueNonClientView::CalculateWindowSizeForClientSize(
@@ -468,7 +549,7 @@ gfx::Size OpaqueNonClientView::CalculateWindowSizeForClientSize(
int height) const {
int top_margin = CalculateNonClientTopHeight();
return gfx::Size(width + (2 * kWindowHorizontalBorderSize),
- height + top_margin + kWindowVerticalBorderSize);
+ height + top_margin + kWindowVerticalBorderBottomSize);
}
CPoint OpaqueNonClientView::GetSystemMenuPoint() const {
@@ -508,9 +589,9 @@ int OpaqueNonClientView::NonClientHitTest(const gfx::Point& point) {
component = GetHTComponentForFrame(
point,
- kResizeAreaSize,
+ kWindowHorizontalBorderSize,
kResizeAreaCornerSize,
- kResizeAreaNorthSize,
+ kWindowVerticalBorderTopSize,
frame_->window_delegate()->CanResize());
if (component == HTNOWHERE) {
// Finally fall back to the caption.
@@ -562,7 +643,7 @@ void OpaqueNonClientView::Paint(ChromeCanvas* canvas) {
// TODO(beng): remove this
gfx::Rect contents_bounds = frame_->GetContentsBounds();
- canvas->FillRectInt(SK_ColorGRAY, contents_bounds.x(), contents_bounds.y(),
+ canvas->FillRectInt(SK_ColorWHITE, contents_bounds.x(), contents_bounds.y(),
contents_bounds.width(), contents_bounds.height());
}
@@ -577,7 +658,7 @@ void OpaqueNonClientView::GetPreferredSize(CSize* out) {
DCHECK(out);
frame_->client_view()->GetPreferredSize(out);
out->cx += 2 * kWindowHorizontalBorderSize;
- out->cy += CalculateNonClientTopHeight() + kWindowVerticalBorderSize;
+ out->cy += CalculateNonClientTopHeight() + kWindowVerticalBorderBottomSize;
}
ChromeViews::View* OpaqueNonClientView::GetViewForPoint(
@@ -626,7 +707,7 @@ int OpaqueNonClientView::CalculateNonClientTopHeight() const {
return kTitleTopOffset + resources()->GetTitleFont().height() +
kTitleBottomSpacing;
}
- return kNoTitleTopSpacing;
+ return frame_->IsMaximized() ? kNoTitleZoomedTopSpacing : kNoTitleTopSpacing;
}
void OpaqueNonClientView::PaintFrameBorder(ChromeCanvas* canvas) {
@@ -756,7 +837,7 @@ void OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) {
frame_->client_view()->GetY() + toolbar_bounds.bottom() - 1,
client_area_bounds.width(),
std::max(0, GetHeight() - frame_->client_view()->GetY() -
- toolbar_bounds.bottom() + 1 - kWindowVerticalBorderSize));
+ toolbar_bounds.bottom() + 1 - kWindowVerticalBorderBottomSize));
canvas->TileImageInt(*right, client_area_bounds.right(),
client_area_bounds.y(),
@@ -772,6 +853,20 @@ void OpaqueNonClientView::PaintClientEdge(ChromeCanvas* canvas) {
canvas->TileImageInt(*left, client_area_bounds.x() - left->width(),
client_area_bounds.y(),
left->width(), client_area_bounds.height());
+
+ if (frame_->window_delegate()->ShouldShowWindowTitle()) {
+ SkBitmap app_top_left = resources()->app_top_left();
+ SkBitmap app_top_center = resources()->app_top_center();
+ SkBitmap app_top_right = resources()->app_top_right();
+ canvas->DrawBitmapInt(app_top_left,
+ client_area_bounds.x() - app_top_left.width(),
+ client_area_bounds.y() - app_top_left.height());
+ canvas->TileImageInt(app_top_center, client_area_bounds.x(),
+ client_area_bounds.y() - app_top_center.height(),
+ client_area_bounds.width(), app_top_center.height());
+ canvas->DrawBitmapInt(app_top_right, client_area_bounds.right(),
+ client_area_bounds.y() - app_top_right.height());
+ }
}
void OpaqueNonClientView::LayoutWindowControls() {
@@ -891,8 +986,6 @@ void OpaqueNonClientView::InitClass() {
if (!initialized) {
active_resources_ = new ActiveWindowResources;
inactive_resources_ = new InactiveWindowResources;
- active_otr_resources_ = new OTRActiveWindowResources;
- inactive_otr_resources_ = new OTRInactiveWindowResources;
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
distributor_logo_ = *rb.GetBitmapNamed(IDR_DISTRIBUTOR_LOGO_LIGHT);