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

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

Issue 9015022: Replace most of Browser::GetSelectedTabContents calls into Browser::GetSelectedWebContents. I've ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "ui/views/window/window_shape.h" 43 #include "ui/views/window/window_shape.h"
44 44
45 #if defined(USE_AURA) 45 #if defined(USE_AURA)
46 #include "ui/aura/aura_switches.h" 46 #include "ui/aura/aura_switches.h"
47 #endif 47 #endif
48 48
49 #if defined(USE_VIRTUAL_KEYBOARD) 49 #if defined(USE_VIRTUAL_KEYBOARD)
50 #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h" 50 #include "chrome/browser/ui/virtual_keyboard/virtual_keyboard_manager.h"
51 #endif 51 #endif
52 52
53 using content::WebContents;
54
53 namespace { 55 namespace {
54 56
55 // The frame border is only visible in restored mode and is hardcoded to 4 px on 57 // The frame border is only visible in restored mode and is hardcoded to 4 px on
56 // each side regardless of the system window border size. 58 // each side regardless of the system window border size.
57 const int kFrameBorderThickness = 4; 59 const int kFrameBorderThickness = 4;
58 // Besides the frame border, there's another 11 px of empty space atop the 60 // Besides the frame border, there's another 11 px of empty space atop the
59 // window in restored mode, to use to drag the window around. 61 // window in restored mode, to use to drag the window around.
60 const int kNonClientRestoredExtraThickness = 11; 62 const int kNonClientRestoredExtraThickness = 11;
61 // While resize areas on Windows are normally the same size as the window 63 // While resize areas on Windows are normally the same size as the window
62 // borders, our top area is shrunk by 1 px to make it easier to move the window 64 // borders, our top area is shrunk by 1 px to make it easier to move the window
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 else if (sender == close_button_) 464 else if (sender == close_button_)
463 frame()->Close(); 465 frame()->Close();
464 } 466 }
465 467
466 /////////////////////////////////////////////////////////////////////////////// 468 ///////////////////////////////////////////////////////////////////////////////
467 // OpaqueBrowserFrameView, TabIconView::TabContentsProvider implementation: 469 // OpaqueBrowserFrameView, TabIconView::TabContentsProvider implementation:
468 470
469 bool OpaqueBrowserFrameView::ShouldTabIconViewAnimate() const { 471 bool OpaqueBrowserFrameView::ShouldTabIconViewAnimate() const {
470 // This function is queried during the creation of the window as the 472 // This function is queried during the creation of the window as the
471 // TabIconView we host is initialized, so we need to NULL check the selected 473 // TabIconView we host is initialized, so we need to NULL check the selected
472 // TabContents because in this condition there is not yet a selected tab. 474 // WebContents because in this condition there is not yet a selected tab.
473 TabContents* current_tab = browser_view()->GetSelectedTabContents(); 475 WebContents* current_tab = browser_view()->GetSelectedWebContents();
474 return current_tab ? current_tab->IsLoading() : false; 476 return current_tab ? current_tab->IsLoading() : false;
475 } 477 }
476 478
477 SkBitmap OpaqueBrowserFrameView::GetFaviconForTabIconView() { 479 SkBitmap OpaqueBrowserFrameView::GetFaviconForTabIconView() {
478 views::WidgetDelegate* delegate = frame()->widget_delegate(); 480 views::WidgetDelegate* delegate = frame()->widget_delegate();
479 if (!delegate) { 481 if (!delegate) {
480 LOG(WARNING) << "delegate is NULL, returning safe default."; 482 LOG(WARNING) << "delegate is NULL, returning safe default.";
481 return SkBitmap(); 483 return SkBitmap();
482 } 484 }
483 return delegate->GetWindowIcon(); 485 return delegate->GetWindowIcon();
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 1060
1059 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, 1061 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
1060 int height) const { 1062 int height) const {
1061 int top_height = NonClientTopBorderHeight(false); 1063 int top_height = NonClientTopBorderHeight(false);
1062 int border_thickness = NonClientBorderThickness(); 1064 int border_thickness = NonClientBorderThickness();
1063 return gfx::Rect(border_thickness, top_height, 1065 return gfx::Rect(border_thickness, top_height,
1064 std::max(0, width - (2 * border_thickness)), 1066 std::max(0, width - (2 * border_thickness)),
1065 std::max(0, height - GetReservedHeight() - 1067 std::max(0, height - GetReservedHeight() -
1066 top_height - border_thickness)); 1068 top_height - border_thickness));
1067 } 1069 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/html_dialog_view_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698