summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/views/frame/browser_view2.cc14
-rw-r--r--chrome/browser/views/frame/browser_view2.h4
-rw-r--r--chrome/browser/views/frame/opaque_frame.cc4
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.cc28
-rw-r--r--chrome/browser/views/frame/opaque_non_client_view.h7
5 files changed, 29 insertions, 28 deletions
diff --git a/chrome/browser/views/frame/browser_view2.cc b/chrome/browser/views/frame/browser_view2.cc
index af62587..8ef7dd3 100644
--- a/chrome/browser/views/frame/browser_view2.cc
+++ b/chrome/browser/views/frame/browser_view2.cc
@@ -150,6 +150,11 @@ bool BrowserView2::IsOffTheRecord() const {
return browser_->profile()->IsOffTheRecord();
}
+bool BrowserView2::ShouldShowOffTheRecordAvatar() const {
+ return IsOffTheRecord() &&
+ browser_->GetType() == BrowserType::TABBED_BROWSER;
+}
+
bool BrowserView2::AcceleratorPressed(
const ChromeViews::Accelerator& accelerator) {
DCHECK(accelerator_table_.get());
@@ -632,15 +637,6 @@ int BrowserView2::NonClientHitTest(const gfx::Point& point) {
wi.cbSize = sizeof(wi);
GetWindowInfo(frame_->GetWindow()->GetHWND(), &wi);
- // Since we say that our client area extends to the top of the window (in
- // the frame's WM_NCHITTEST handler.
- CRect lb;
- GetLocalBounds(&lb, true);
- if (lb.PtInRect(point.ToPOINT())) {
- if (point.y() < static_cast<int>(wi.cyWindowBorders))
- return HTTOP;
- }
-
CPoint point_in_view_coords(point.ToPOINT());
View::ConvertPointToView(GetParent(), this, &point_in_view_coords);
if (IsTabStripVisible() && tabstrip_->HitTest(point_in_view_coords) &&
diff --git a/chrome/browser/views/frame/browser_view2.h b/chrome/browser/views/frame/browser_view2.h
index 903be7c..0e1c0da 100644
--- a/chrome/browser/views/frame/browser_view2.h
+++ b/chrome/browser/views/frame/browser_view2.h
@@ -88,6 +88,10 @@ class BrowserView2 : public BrowserWindow,
// off the record.
bool IsOffTheRecord() const;
+ // Returns true if the non-client view should render the Off-The-Record
+ // avatar icon if the window is off the record.
+ bool ShouldShowOffTheRecordAvatar() const;
+
// Handle the specified |accelerator| being pressed.
bool AcceleratorPressed(const ChromeViews::Accelerator& accelerator);
diff --git a/chrome/browser/views/frame/opaque_frame.cc b/chrome/browser/views/frame/opaque_frame.cc
index f70eb31..b1dc66a 100644
--- a/chrome/browser/views/frame/opaque_frame.cc
+++ b/chrome/browser/views/frame/opaque_frame.cc
@@ -39,8 +39,8 @@
// OpaqueFrame, public:
OpaqueFrame::OpaqueFrame(BrowserView2* browser_view)
- : CustomFrameWindow(browser_view, new OpaqueNonClientView(
- this, browser_view, browser_view->IsOffTheRecord())),
+ : CustomFrameWindow(browser_view, new OpaqueNonClientView(this,
+ browser_view)),
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 505e367..74ee8b1 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.cc
+++ b/chrome/browser/views/frame/opaque_non_client_view.cc
@@ -432,8 +432,7 @@ static const int kNoTitleOTRZoomedTopSpacing = 3;
// OpaqueNonClientView, public:
OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame,
- BrowserView2* browser_view,
- bool is_otr)
+ BrowserView2* browser_view)
: NonClientView(),
minimize_button_(new ChromeViews::Button),
maximize_button_(new ChromeViews::Button),
@@ -441,10 +440,9 @@ OpaqueNonClientView::OpaqueNonClientView(OpaqueFrame* frame,
close_button_(new ChromeViews::Button),
window_icon_(new TabIconView(this)),
frame_(frame),
- browser_view_(browser_view),
- is_otr_(is_otr) {
+ browser_view_(browser_view) {
InitClass();
- if (is_otr) {
+ 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;
@@ -807,7 +805,7 @@ void OpaqueNonClientView::PaintMaximizedFrameBorder(ChromeCanvas* canvas) {
}
void OpaqueNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) {
- if (is_otr_) {
+ if (browser_view_->ShouldShowOffTheRecordAvatar()) {
canvas->DrawBitmapInt(browser_view_->GetOTRAvatarIcon(),
otr_avatar_bounds_.x(), otr_avatar_bounds_.y());
}
@@ -998,7 +996,7 @@ void OpaqueNonClientView::LayoutOTRAvatar() {
int otr_y = browser_view_->GetTabStripHeight() + top_spacing;
int otr_width = 0;
int otr_height = 0;
- if (is_otr_) {
+ if (browser_view_->ShouldShowOffTheRecordAvatar()) {
SkBitmap otr_avatar_icon = browser_view_->GetOTRAvatarIcon();
otr_width = otr_avatar_icon.width();
otr_height = otr_avatar_icon.height();
@@ -1011,10 +1009,18 @@ void OpaqueNonClientView::LayoutOTRAvatar() {
void OpaqueNonClientView::LayoutDistributorLogo() {
int logo_w = distributor_logo_.width();
int logo_h = distributor_logo_.height();
-
- logo_bounds_.SetRect(
- minimize_button_->GetX() - logo_w - kDistributorLogoHorizontalOffset,
- kDistributorLogoVerticalOffset, logo_w, logo_h);
+
+ int logo_x = 0;
+ if (UILayoutIsRightToLeft()) {
+ CRect minimize_bounds;
+ minimize_button_->GetBounds(&minimize_bounds,
+ APPLY_MIRRORING_TRANSFORMATION);
+ logo_x = minimize_bounds.right + kDistributorLogoHorizontalOffset;
+ } else {
+ logo_x = minimize_button_->GetX() - logo_w -
+ kDistributorLogoHorizontalOffset;
+ }
+ logo_bounds_.SetRect(logo_x, kDistributorLogoVerticalOffset, logo_w, logo_h);
}
void OpaqueNonClientView::LayoutTitleBar() {
diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h
index 309f58c..69a00df3 100644
--- a/chrome/browser/views/frame/opaque_non_client_view.h
+++ b/chrome/browser/views/frame/opaque_non_client_view.h
@@ -48,9 +48,7 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
// Constructs a non-client view for an OpaqueFrame. |is_otr| specifies if the
// frame was created "off-the-record" and as such different bitmaps should be
// used to render the frame.
- OpaqueNonClientView(OpaqueFrame* frame,
- BrowserView2* browser_view,
- bool is_otr);
+ OpaqueNonClientView(OpaqueFrame* frame, BrowserView2* browser_view);
virtual ~OpaqueNonClientView();
// Retrieve the bounds of the window for the specified contents bounds.
@@ -145,9 +143,6 @@ class OpaqueNonClientView : public ChromeViews::NonClientView,
// The BrowserView hosted within this View.
BrowserView2* browser_view_;
- // True if we are an OTR frame.
- bool is_otr_;
-
// The resources currently used to paint this view.
WindowResources* current_active_resources_;
WindowResources* current_inactive_resources_;