| OLD | NEW |
| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 NonClientTopBorderHeight(false, false), ps.width(), | 271 NonClientTopBorderHeight(false, false), ps.width(), |
| 272 browser_view_->height()); | 272 browser_view_->height()); |
| 273 } | 273 } |
| 274 | 274 |
| 275 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? | 275 int tabstrip_x = browser_view_->ShouldShowOffTheRecordAvatar() ? |
| 276 (otr_avatar_bounds_.right() + kOTRSideSpacing) : | 276 (otr_avatar_bounds_.right() + kOTRSideSpacing) : |
| 277 NonClientBorderThickness() + kTabStripIndent; | 277 NonClientBorderThickness() + kTabStripIndent; |
| 278 | 278 |
| 279 int maximized_spacing = | 279 int maximized_spacing = |
| 280 kNewTabCaptionMaximizedSpacing + | 280 kNewTabCaptionMaximizedSpacing + |
| 281 (show_profile_button() && profile_button_->IsVisible() ? | 281 (show_profile_button() && profile_button_->visible() ? |
| 282 profile_button_->GetPreferredSize().width() + | 282 profile_button_->GetPreferredSize().width() + |
| 283 ProfileMenuButton::kProfileTagHorizontalSpacing : 0); | 283 ProfileMenuButton::kProfileTagHorizontalSpacing : 0); |
| 284 int tabstrip_width = minimize_button_->x() - tabstrip_x - | 284 int tabstrip_width = minimize_button_->x() - tabstrip_x - |
| 285 (frame_->IsMaximized() ? | 285 (frame_->IsMaximized() ? |
| 286 maximized_spacing : kNewTabCaptionRestoredSpacing); | 286 maximized_spacing : kNewTabCaptionRestoredSpacing); |
| 287 int tabstrip_height = 0; | 287 int tabstrip_height = 0; |
| 288 if (tabstrip) | 288 if (tabstrip) |
| 289 tabstrip_height = tabstrip->GetPreferredSize().height(); | 289 tabstrip_height = tabstrip->GetPreferredSize().height(); |
| 290 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), | 290 return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), |
| 291 std::max(0, tabstrip_width), tabstrip_height); | 291 std::max(0, tabstrip_width), tabstrip_height); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 if (frame_->IsMaximized()) | 357 if (frame_->IsMaximized()) |
| 358 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom()); | 358 sysmenu_rect.SetRect(0, 0, sysmenu_rect.right(), sysmenu_rect.bottom()); |
| 359 sysmenu_rect.set_x(GetMirroredXForRect(sysmenu_rect)); | 359 sysmenu_rect.set_x(GetMirroredXForRect(sysmenu_rect)); |
| 360 if (sysmenu_rect.Contains(point)) | 360 if (sysmenu_rect.Contains(point)) |
| 361 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU; | 361 return (frame_component == HTCLIENT) ? HTCLIENT : HTSYSMENU; |
| 362 | 362 |
| 363 if (frame_component != HTNOWHERE) | 363 if (frame_component != HTNOWHERE) |
| 364 return frame_component; | 364 return frame_component; |
| 365 | 365 |
| 366 // Then see if the point is within any of the window controls. | 366 // Then see if the point is within any of the window controls. |
| 367 if (close_button_->IsVisible() && | 367 if (close_button_->visible() && |
| 368 close_button_->GetMirroredBounds().Contains(point)) | 368 close_button_->GetMirroredBounds().Contains(point)) |
| 369 return HTCLOSE; | 369 return HTCLOSE; |
| 370 if (restore_button_->IsVisible() && | 370 if (restore_button_->visible() && |
| 371 restore_button_->GetMirroredBounds().Contains(point)) | 371 restore_button_->GetMirroredBounds().Contains(point)) |
| 372 return HTMAXBUTTON; | 372 return HTMAXBUTTON; |
| 373 if (maximize_button_->IsVisible() && | 373 if (maximize_button_->visible() && |
| 374 maximize_button_->GetMirroredBounds().Contains(point)) | 374 maximize_button_->GetMirroredBounds().Contains(point)) |
| 375 return HTMAXBUTTON; | 375 return HTMAXBUTTON; |
| 376 if (minimize_button_->IsVisible() && | 376 if (minimize_button_->visible() && |
| 377 minimize_button_->GetMirroredBounds().Contains(point)) | 377 minimize_button_->GetMirroredBounds().Contains(point)) |
| 378 return HTMINBUTTON; | 378 return HTMINBUTTON; |
| 379 | 379 |
| 380 // See if the point is within the profile menu button. | 380 // See if the point is within the profile menu button. |
| 381 if (show_profile_button() && profile_button_->IsVisible() && | 381 if (show_profile_button() && profile_button_->visible() && |
| 382 profile_button_->GetMirroredBounds().Contains(point)) | 382 profile_button_->GetMirroredBounds().Contains(point)) |
| 383 return HTCLIENT; | 383 return HTCLIENT; |
| 384 | 384 |
| 385 views::WindowDelegate* delegate = frame_->window_delegate(); | 385 views::WindowDelegate* delegate = frame_->window_delegate(); |
| 386 if (!delegate) { | 386 if (!delegate) { |
| 387 LOG(WARNING) << "delegate is NULL, returning safe default."; | 387 LOG(WARNING) << "delegate is NULL, returning safe default."; |
| 388 return HTCAPTION; | 388 return HTCAPTION; |
| 389 } | 389 } |
| 390 int window_component = GetHTComponentForFrame(point, TopResizeHeight(), | 390 int window_component = GetHTComponentForFrame(point, TopResizeHeight(), |
| 391 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, | 391 NonClientBorderThickness(), kResizeAreaCornerSize, kResizeAreaCornerSize, |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 std::max(0, width - (2 * border_thickness)), | 1213 std::max(0, width - (2 * border_thickness)), |
| 1214 std::max(0, height - GetReservedHeight() - | 1214 std::max(0, height - GetReservedHeight() - |
| 1215 top_height - border_thickness)); | 1215 top_height - border_thickness)); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 void OpaqueBrowserFrameView::RegisterLoginNotifications() { | 1218 void OpaqueBrowserFrameView::RegisterLoginNotifications() { |
| 1219 PrefService* pref_service = browser_view_->browser()->profile()->GetPrefs(); | 1219 PrefService* pref_service = browser_view_->browser()->profile()->GetPrefs(); |
| 1220 DCHECK(pref_service); | 1220 DCHECK(pref_service); |
| 1221 username_pref_.Init(prefs::kGoogleServicesUsername, pref_service, this); | 1221 username_pref_.Init(prefs::kGoogleServicesUsername, pref_service, this); |
| 1222 } | 1222 } |
| OLD | NEW |