Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/views/frame/browser_view.cc

Issue 28168: Prevent the display of the resize corner bitmap on top of the download shelf ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 6
7 #include "chrome/browser/views/frame/browser_view.h" 7 #include "chrome/browser/views/frame/browser_view.h"
8 8
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 { false, IDC_RELOAD, IDS_APP_MENU_RELOAD }, 119 { false, IDC_RELOAD, IDS_APP_MENU_RELOAD },
120 { false, IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD }, 120 { false, IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD },
121 { false, IDC_BACK, IDS_CONTENT_CONTEXT_BACK } 121 { false, IDC_BACK, IDS_CONTENT_CONTEXT_BACK }
122 }; 122 };
123 123
124 /////////////////////////////////////////////////////////////////////////////// 124 ///////////////////////////////////////////////////////////////////////////////
125 // ResizeCorner, private: 125 // ResizeCorner, private:
126 126
127 class ResizeCorner : public views::View { 127 class ResizeCorner : public views::View {
128 public: 128 public:
129 ResizeCorner() {} 129 ResizeCorner(const BrowserWindow* parent)
130 : parent_(parent) {
131 }
132
130 virtual void Paint(ChromeCanvas* canvas) { 133 virtual void Paint(ChromeCanvas* canvas) {
134 if (parent_ && (parent_->IsMaximized() || parent_->IsFullscreen()))
135 return;
136
131 SkBitmap * bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed( 137 SkBitmap * bitmap = ResourceBundle::GetSharedInstance().GetBitmapNamed(
132 IDR_TEXTAREA_RESIZER); 138 IDR_TEXTAREA_RESIZER);
133 bitmap->buildMipMap(false); 139 bitmap->buildMipMap(false);
134 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); 140 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT);
135 if (rtl_dir) { 141 if (rtl_dir) {
136 canvas->TranslateInt(width(), 0); 142 canvas->TranslateInt(width(), 0);
137 canvas->ScaleInt(-1, 1); 143 canvas->ScaleInt(-1, 1);
138 canvas->save(); 144 canvas->save();
139 } 145 }
140 canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(), 146 canvas->DrawBitmapInt(*bitmap, width() - bitmap->width(),
141 height() - bitmap->height()); 147 height() - bitmap->height());
142 if (rtl_dir) 148 if (rtl_dir)
143 canvas->restore(); 149 canvas->restore();
144 } 150 }
145 151
146 static gfx::Size GetSize() { 152 static gfx::Size GetSize() {
147 return gfx::Size(views::NativeScrollBar::GetVerticalScrollBarWidth(), 153 return gfx::Size(views::NativeScrollBar::GetVerticalScrollBarWidth(),
148 views::NativeScrollBar::GetHorizontalScrollBarHeight()); 154 views::NativeScrollBar::GetHorizontalScrollBarHeight());
149 } 155 }
150 156
151 virtual gfx::Size GetPreferredSize() { 157 virtual gfx::Size GetPreferredSize() {
158 if (parent_ && (parent_->IsMaximized() || parent_->IsFullscreen()))
159 return gfx::Size();
152 return GetSize(); 160 return GetSize();
153 } 161 }
154 162
155 virtual void Layout() { 163 virtual void Layout() {
156 views::View* parent_view = GetParent(); 164 views::View* parent_view = GetParent();
157 if (parent_view) { 165 if (parent_view) {
158 gfx::Size ps = GetPreferredSize(); 166 gfx::Size ps = GetPreferredSize();
159 // No need to handle Right to left text direction here, 167 // No need to handle Right to left text direction here,
160 // our parent must take care of it for us... 168 // our parent must take care of it for us...
161 SetBounds(parent_view->width() - ps.width(), 169 SetBounds(parent_view->width() - ps.width(),
162 parent_view->height() - ps.height(), ps.width(), ps.height()); 170 parent_view->height() - ps.height(), ps.width(), ps.height());
163 } 171 }
164 } 172 }
165 173
166 private: 174 private:
175 const BrowserWindow* parent_;
167 DISALLOW_COPY_AND_ASSIGN(ResizeCorner); 176 DISALLOW_COPY_AND_ASSIGN(ResizeCorner);
168 }; 177 };
169 178
170 179
171 /////////////////////////////////////////////////////////////////////////////// 180 ///////////////////////////////////////////////////////////////////////////////
172 // BrowserView, public: 181 // BrowserView, public:
173 182
174 // static 183 // static
175 void BrowserView::SetShowState(int state) { 184 void BrowserView::SetShowState(int state) {
176 explicit_show_state = state; 185 explicit_show_state = state;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 browser_.reset(); 712 browser_.reset();
704 } 713 }
705 714
706 bool BrowserView::IsBookmarkBarVisible() const { 715 bool BrowserView::IsBookmarkBarVisible() const {
707 return SupportsWindowFeature(FEATURE_BOOKMARKBAR) && 716 return SupportsWindowFeature(FEATURE_BOOKMARKBAR) &&
708 bookmark_bar_view_.get() && 717 bookmark_bar_view_.get() &&
709 (bookmark_bar_view_->GetPreferredSize().height() != 0); 718 (bookmark_bar_view_->GetPreferredSize().height() != 0);
710 } 719 }
711 720
712 gfx::Rect BrowserView::GetRootWindowResizerRect() const { 721 gfx::Rect BrowserView::GetRootWindowResizerRect() const {
713 // There is no resize corner when we are maximized 722 // There is no resize corner when we are maximized or full screen
714 if (IsMaximized()) 723 if (IsMaximized() || IsFullscreen())
715 return gfx::Rect(); 724 return gfx::Rect();
716 725
717 // We don't specify a resize corner size if we have a bottom shelf either. 726 // We don't specify a resize corner size if we have a bottom shelf either.
718 // This is because we take care of drawing the resize corner on top of that 727 // This is because we take care of drawing the resize corner on top of that
719 // shelf, so we don't want others to do it for us in this case. 728 // shelf, so we don't want others to do it for us in this case.
720 // Currently, the only visible bottom shelf is the download shelf. 729 // Currently, the only visible bottom shelf is the download shelf.
721 // Other tests should be added here if we add more bottom shelves. 730 // Other tests should be added here if we add more bottom shelves.
722 TabContents* current_tab = browser_->GetSelectedTabContents(); 731 TabContents* current_tab = browser_->GetSelectedTabContents();
723 if (current_tab && current_tab->IsDownloadShelfVisible()) { 732 if (current_tab && current_tab->IsDownloadShelfVisible()) {
724 DownloadShelfView* download_shelf = current_tab->GetDownloadShelfView(); 733 DownloadShelfView* download_shelf = current_tab->GetDownloadShelfView();
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 return true; 1107 return true;
1099 } 1108 }
1100 1109
1101 int BrowserView::NonClientHitTest(const gfx::Point& point) { 1110 int BrowserView::NonClientHitTest(const gfx::Point& point) {
1102 // Since the TabStrip only renders in some parts of the top of the window, 1111 // Since the TabStrip only renders in some parts of the top of the window,
1103 // the un-obscured area is considered to be part of the non-client caption 1112 // the un-obscured area is considered to be part of the non-client caption
1104 // area of the window. So we need to treat hit-tests in these regions as 1113 // area of the window. So we need to treat hit-tests in these regions as
1105 // hit-tests of the titlebar. 1114 // hit-tests of the titlebar.
1106 1115
1107 // There is not resize corner when we are maximised 1116 // There is not resize corner when we are maximised
1108 if (!IsMaximized()) { 1117 if (!IsMaximized() && !IsFullscreen()) {
1109 CRect client_rect; 1118 CRect client_rect;
1110 ::GetClientRect(frame_->GetWindow()->GetHWND(), &client_rect); 1119 ::GetClientRect(frame_->GetWindow()->GetHWND(), &client_rect);
1111 gfx::Size resize_corner_size = ResizeCorner::GetSize(); 1120 gfx::Size resize_corner_size = ResizeCorner::GetSize();
1112 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(), 1121 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(),
1113 client_rect.bottom - resize_corner_size.height(), 1122 client_rect.bottom - resize_corner_size.height(),
1114 resize_corner_size.width(), resize_corner_size.height()); 1123 resize_corner_size.width(), resize_corner_size.height());
1115 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT); 1124 bool rtl_dir = (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT);
1116 if (rtl_dir) 1125 if (rtl_dir)
1117 resize_corner_rect.set_x(0); 1126 resize_corner_rect.set_x(0);
1118 if (resize_corner_rect.Contains(point)) { 1127 if (resize_corner_rect.Contains(point)) {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 // InfoBarContainer, DownloadShelfView and TabContents and this 1441 // InfoBarContainer, DownloadShelfView and TabContents and this
1433 // view is sorted out. 1442 // view is sorted out.
1434 return true; 1443 return true;
1435 } 1444 }
1436 1445
1437 bool BrowserView::MaybeShowDownloadShelf(TabContents* contents) { 1446 bool BrowserView::MaybeShowDownloadShelf(TabContents* contents) {
1438 views::View* new_shelf = NULL; 1447 views::View* new_shelf = NULL;
1439 if (contents && contents->IsDownloadShelfVisible()) { 1448 if (contents && contents->IsDownloadShelfVisible()) {
1440 new_shelf = contents->GetDownloadShelfView(); 1449 new_shelf = contents->GetDownloadShelfView();
1441 if (new_shelf != active_download_shelf_) 1450 if (new_shelf != active_download_shelf_)
1442 new_shelf->AddChildView(new ResizeCorner()); 1451 new_shelf->AddChildView(new ResizeCorner(this));
1443 } 1452 }
1444 return UpdateChildViewAndLayout(new_shelf, &active_download_shelf_); 1453 return UpdateChildViewAndLayout(new_shelf, &active_download_shelf_);
1445 } 1454 }
1446 1455
1447 void BrowserView::UpdateUIForContents(TabContents* contents) { 1456 void BrowserView::UpdateUIForContents(TabContents* contents) {
1448 bool needs_layout = MaybeShowBookmarkBar(contents); 1457 bool needs_layout = MaybeShowBookmarkBar(contents);
1449 needs_layout |= MaybeShowInfoBar(contents); 1458 needs_layout |= MaybeShowInfoBar(contents);
1450 needs_layout |= MaybeShowDownloadShelf(contents); 1459 needs_layout |= MaybeShowDownloadShelf(contents);
1451 if (needs_layout) 1460 if (needs_layout)
1452 Layout(); 1461 Layout();
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 1647
1639 // static 1648 // static
1640 void BrowserView::InitClass() { 1649 void BrowserView::InitClass() {
1641 static bool initialized = false; 1650 static bool initialized = false;
1642 if (!initialized) { 1651 if (!initialized) {
1643 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 1652 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
1644 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON); 1653 default_favicon_ = *rb.GetBitmapNamed(IDR_DEFAULT_FAVICON);
1645 initialized = true; 1654 initialized = true;
1646 } 1655 }
1647 } 1656 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698