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

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

Issue 14362005: Remove unused ResizeCorner code from BrowserView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « chrome/browser/ui/views/frame/browser_view.h ('k') | 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 DetachableToolbarView::PaintBackgroundAttachedMode(canvas, host_view_, 371 DetachableToolbarView::PaintBackgroundAttachedMode(canvas, host_view_,
372 browser_view_->OffsetPointForToolbarBackgroundImage( 372 browser_view_->OffsetPointForToolbarBackgroundImage(
373 gfx::Point(host_view_->GetMirroredX(), host_view_->y())), 373 gfx::Point(host_view_->GetMirroredX(), host_view_->y())),
374 browser_->host_desktop_type()); 374 browser_->host_desktop_type());
375 if (host_view_->height() >= toolbar_overlap) 375 if (host_view_->height() >= toolbar_overlap)
376 DetachableToolbarView::PaintHorizontalBorderForState(canvas, host_view_); 376 DetachableToolbarView::PaintHorizontalBorderForState(canvas, host_view_);
377 } 377 }
378 } 378 }
379 379
380 /////////////////////////////////////////////////////////////////////////////// 380 ///////////////////////////////////////////////////////////////////////////////
381 // ResizeCorner, private:
382
383 class ResizeCorner : public views::View {
384 public:
385 ResizeCorner() {
386 EnableCanvasFlippingForRTLUI(true);
387 }
388
389 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
390 views::Widget* widget = GetWidget();
391 if (!widget || (widget->IsMaximized() || widget->IsFullscreen()))
392 return;
393
394 gfx::ImageSkia* image = ui::ResourceBundle::GetSharedInstance().
395 GetImageSkiaNamed(IDR_TEXTAREA_RESIZER);
396 canvas->DrawImageInt(*image, width() - image->width(),
397 height() - image->height());
398 }
399
400 static gfx::Size GetSize() {
401 // This is disabled until we find what makes us slower when we let
402 // WebKit know that we have a resizer rect...
403 // int scrollbar_thickness = gfx::scrollbar_size();
404 // return gfx::Size(scrollbar_thickness, scrollbar_thickness);
405 return gfx::Size();
406 }
407
408 virtual gfx::Size GetPreferredSize() OVERRIDE {
409 views::Widget* widget = GetWidget();
410 return (!widget || widget->IsMaximized() || widget->IsFullscreen()) ?
411 gfx::Size() : GetSize();
412 }
413
414 virtual void Layout() OVERRIDE {
415 if (parent()) {
416 gfx::Size ps = GetPreferredSize();
417 // No need to handle Right to left text direction here,
418 // our parent must take care of it for us...
419 SetBounds(parent()->width() - ps.width(),
420 parent()->height() - ps.height(), ps.width(), ps.height());
421 }
422 }
423
424 private:
425 DISALLOW_COPY_AND_ASSIGN(ResizeCorner);
426 };
427
428 ///////////////////////////////////////////////////////////////////////////////
429 // BrowserView, public: 381 // BrowserView, public:
430 382
431 BrowserView::BrowserView(Browser* browser) 383 BrowserView::BrowserView(Browser* browser)
432 : views::ClientView(NULL, NULL), 384 : views::ClientView(NULL, NULL),
433 last_focused_view_storage_id_( 385 last_focused_view_storage_id_(
434 views::ViewStorage::GetInstance()->CreateStorageID()), 386 views::ViewStorage::GetInstance()->CreateStorageID()),
435 frame_(NULL), 387 frame_(NULL),
436 browser_(browser), 388 browser_(browser),
437 top_container_(NULL), 389 top_container_(NULL),
438 tabstrip_(NULL), 390 tabstrip_(NULL),
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 } 1125 }
1174 1126
1175 bool BrowserView::IsToolbarVisible() const { 1127 bool BrowserView::IsToolbarVisible() const {
1176 if (immersive_mode_controller_->ShouldHideTopViews()) 1128 if (immersive_mode_controller_->ShouldHideTopViews())
1177 return false; 1129 return false;
1178 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) || 1130 return browser_->SupportsWindowFeature(Browser::FEATURE_TOOLBAR) ||
1179 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR); 1131 browser_->SupportsWindowFeature(Browser::FEATURE_LOCATIONBAR);
1180 } 1132 }
1181 1133
1182 gfx::Rect BrowserView::GetRootWindowResizerRect() const { 1134 gfx::Rect BrowserView::GetRootWindowResizerRect() const {
1183 if (frame_->IsMaximized() || frame_->IsFullscreen()) 1135 // Views does not support resizer rects because they caused page cycler
1184 return gfx::Rect(); 1136 // performance regressions when they were added. See crrev.com/9654
1185 1137 return gfx::Rect();
1186 // We don't specify a resize corner size if we have a bottom shelf either.
1187 // This is because we take care of drawing the resize corner on top of that
1188 // shelf, so we don't want others to do it for us in this case.
1189 // Currently, the only visible bottom shelf is the download shelf.
1190 // Other tests should be added here if we add more bottom shelves.
1191 if (IsDownloadShelfVisible())
1192 return gfx::Rect();
1193
1194 gfx::Rect client_rect = contents_split_->bounds();
1195 gfx::Size resize_corner_size = ResizeCorner::GetSize();
1196 int x = client_rect.width() - resize_corner_size.width();
1197 if (base::i18n::IsRTL())
1198 x = 0;
1199 return gfx::Rect(x, client_rect.height() - resize_corner_size.height(),
1200 resize_corner_size.width(), resize_corner_size.height());
1201 } 1138 }
1202 1139
1203 void BrowserView::DisableInactiveFrame() { 1140 void BrowserView::DisableInactiveFrame() {
1204 #if defined(OS_WIN) && !defined(USE_AURA) 1141 #if defined(OS_WIN) && !defined(USE_AURA)
1205 frame_->DisableInactiveRendering(); 1142 frame_->DisableInactiveRendering();
1206 #endif // No tricks are needed to get the right behavior on Linux. 1143 #endif // No tricks are needed to get the right behavior on Linux.
1207 } 1144 }
1208 1145
1209 void BrowserView::ConfirmAddSearchProvider(TemplateURL* template_url, 1146 void BrowserView::ConfirmAddSearchProvider(TemplateURL* template_url,
1210 Profile* profile) { 1147 Profile* profile) {
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 1801
1865 // Empty TabStripModel, it's now safe to allow the Window to be closed. 1802 // Empty TabStripModel, it's now safe to allow the Window to be closed.
1866 content::NotificationService::current()->Notify( 1803 content::NotificationService::current()->Notify(
1867 chrome::NOTIFICATION_WINDOW_CLOSED, 1804 chrome::NOTIFICATION_WINDOW_CLOSED,
1868 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()), 1805 content::Source<gfx::NativeWindow>(frame_->GetNativeWindow()),
1869 content::NotificationService::NoDetails()); 1806 content::NotificationService::NoDetails());
1870 return true; 1807 return true;
1871 } 1808 }
1872 1809
1873 int BrowserView::NonClientHitTest(const gfx::Point& point) { 1810 int BrowserView::NonClientHitTest(const gfx::Point& point) {
1874 #if defined(OS_WIN) && !defined(USE_AURA)
1875 // The following code is not in the LayoutManager because it's
1876 // independent of layout and also depends on the ResizeCorner which
1877 // is private.
1878 if (!frame_->IsMaximized() && !frame_->IsFullscreen()) {
1879 CRect client_rect;
1880 ::GetClientRect(frame_->GetNativeWindow(), &client_rect);
1881 gfx::Size resize_corner_size = ResizeCorner::GetSize();
1882 gfx::Rect resize_corner_rect(client_rect.right - resize_corner_size.width(),
1883 client_rect.bottom - resize_corner_size.height(),
1884 resize_corner_size.width(), resize_corner_size.height());
1885 bool rtl_dir = base::i18n::IsRTL();
1886 if (rtl_dir)
1887 resize_corner_rect.set_x(0);
1888 if (resize_corner_rect.Contains(point)) {
1889 if (rtl_dir)
1890 return HTBOTTOMLEFT;
1891 return HTBOTTOMRIGHT;
1892 }
1893 }
1894 #endif
1895
1896 return GetBrowserViewLayout()->NonClientHitTest(point); 1811 return GetBrowserViewLayout()->NonClientHitTest(point);
1897 } 1812 }
1898 1813
1899 gfx::Size BrowserView::GetMinimumSize() { 1814 gfx::Size BrowserView::GetMinimumSize() {
1900 return GetBrowserViewLayout()->GetMinimumSize(); 1815 return GetBrowserViewLayout()->GetMinimumSize();
1901 } 1816 }
1902 1817
1903 /////////////////////////////////////////////////////////////////////////////// 1818 ///////////////////////////////////////////////////////////////////////////////
1904 // BrowserView, views::View overrides: 1819 // BrowserView, views::View overrides:
1905 1820
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2585 else if (key_code == ui::VKEY_K) 2500 else if (key_code == ui::VKEY_K)
2586 content::RecordAction(UserMetricsAction("Accel_FocusSearch_K")); 2501 content::RecordAction(UserMetricsAction("Accel_FocusSearch_K"));
2587 break; 2502 break;
2588 default: 2503 default:
2589 // Do nothing. 2504 // Do nothing.
2590 break; 2505 break;
2591 } 2506 }
2592 #endif 2507 #endif
2593 } 2508 }
2594 2509
2595 gfx::Size BrowserView::GetResizeCornerSize() const {
2596 return ResizeCorner::GetSize();
2597 }
2598
2599 void BrowserView::CreateLauncherIcon() { 2510 void BrowserView::CreateLauncherIcon() {
2600 #if defined(USE_ASH) 2511 #if defined(USE_ASH)
2601 if (chrome::IsNativeWindowInAsh(GetNativeWindow()) && 2512 if (chrome::IsNativeWindowInAsh(GetNativeWindow()) &&
2602 !launcher_item_controller_.get()) { 2513 !launcher_item_controller_.get()) {
2603 launcher_item_controller_.reset( 2514 launcher_item_controller_.reset(
2604 BrowserLauncherItemController::Create(browser_.get())); 2515 BrowserLauncherItemController::Create(browser_.get()));
2605 } 2516 }
2606 #endif // defined(USE_ASH) 2517 #endif // defined(USE_ASH)
2607 } 2518 }
2608 2519
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 2638
2728 Browser* modal_browser = 2639 Browser* modal_browser =
2729 chrome::FindBrowserWithWebContents(active_dialog->web_contents()); 2640 chrome::FindBrowserWithWebContents(active_dialog->web_contents());
2730 if (modal_browser && (browser_ != modal_browser)) { 2641 if (modal_browser && (browser_ != modal_browser)) {
2731 modal_browser->window()->FlashFrame(true); 2642 modal_browser->window()->FlashFrame(true);
2732 modal_browser->window()->Activate(); 2643 modal_browser->window()->Activate();
2733 } 2644 }
2734 2645
2735 AppModalDialogQueue::GetInstance()->ActivateModalDialog(); 2646 AppModalDialogQueue::GetInstance()->ActivateModalDialog();
2736 } 2647 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698