| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 282 } |
| 283 | 283 |
| 284 void OpaqueBrowserFrameView::UpdateWindowTitle() { | 284 void OpaqueBrowserFrameView::UpdateWindowTitle() { |
| 285 if (!frame()->IsFullscreen()) | 285 if (!frame()->IsFullscreen()) |
| 286 window_title_->SchedulePaint(); | 286 window_title_->SchedulePaint(); |
| 287 } | 287 } |
| 288 | 288 |
| 289 /////////////////////////////////////////////////////////////////////////////// | 289 /////////////////////////////////////////////////////////////////////////////// |
| 290 // OpaqueBrowserFrameView, views::View overrides: | 290 // OpaqueBrowserFrameView, views::View overrides: |
| 291 | 291 |
| 292 bool OpaqueBrowserFrameView::HitTestRect(const gfx::Rect& rect) const { | 292 void OpaqueBrowserFrameView::GetAccessibleState( |
| 293 if (!views::View::HitTestRect(rect)) { | 293 ui::AXViewState* state) { |
| 294 state->role = ui::AX_ROLE_TITLE_BAR; |
| 295 } |
| 296 |
| 297 /////////////////////////////////////////////////////////////////////////////// |
| 298 // OpaqueBrowserFrameView, views::ViewTargeterDelegate overrides: |
| 299 |
| 300 bool OpaqueBrowserFrameView::DoesIntersectRect(const views::View* target, |
| 301 const gfx::Rect& rect) const { |
| 302 CHECK_EQ(target, this); |
| 303 if (!views::ViewTargeterDelegate::DoesIntersectRect(this, rect)) { |
| 294 // |rect| is outside OpaqueBrowserFrameView's bounds. | 304 // |rect| is outside OpaqueBrowserFrameView's bounds. |
| 295 return false; | 305 return false; |
| 296 } | 306 } |
| 297 | 307 |
| 298 // If the rect is outside the bounds of the client area, claim it. | 308 // If the rect is outside the bounds of the client area, claim it. |
| 299 gfx::RectF rect_in_client_view_coords_f(rect); | 309 gfx::RectF rect_in_client_view_coords_f(rect); |
| 300 View::ConvertRectToTarget(this, frame()->client_view(), | 310 View::ConvertRectToTarget(this, frame()->client_view(), |
| 301 &rect_in_client_view_coords_f); | 311 &rect_in_client_view_coords_f); |
| 302 gfx::Rect rect_in_client_view_coords = gfx::ToEnclosingRect( | 312 gfx::Rect rect_in_client_view_coords = gfx::ToEnclosingRect( |
| 303 rect_in_client_view_coords_f); | 313 rect_in_client_view_coords_f); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 323 // Claim |rect| if it is in a non-tab portion of the tabstrip. | 333 // Claim |rect| if it is in a non-tab portion of the tabstrip. |
| 324 return tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords); | 334 return tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords); |
| 325 } | 335 } |
| 326 | 336 |
| 327 // We claim |rect| because it is above the bottom of the tabstrip, but | 337 // We claim |rect| because it is above the bottom of the tabstrip, but |
| 328 // not in the tabstrip itself. In particular, the avatar label/button is left | 338 // not in the tabstrip itself. In particular, the avatar label/button is left |
| 329 // of the tabstrip and the window controls are right of the tabstrip. | 339 // of the tabstrip and the window controls are right of the tabstrip. |
| 330 return true; | 340 return true; |
| 331 } | 341 } |
| 332 | 342 |
| 333 void OpaqueBrowserFrameView::GetAccessibleState( | |
| 334 ui::AXViewState* state) { | |
| 335 state->role = ui::AX_ROLE_TITLE_BAR; | |
| 336 } | |
| 337 | |
| 338 /////////////////////////////////////////////////////////////////////////////// | 343 /////////////////////////////////////////////////////////////////////////////// |
| 339 // OpaqueBrowserFrameView, views::ButtonListener implementation: | 344 // OpaqueBrowserFrameView, views::ButtonListener implementation: |
| 340 | 345 |
| 341 void OpaqueBrowserFrameView::ButtonPressed(views::Button* sender, | 346 void OpaqueBrowserFrameView::ButtonPressed(views::Button* sender, |
| 342 const ui::Event& event) { | 347 const ui::Event& event) { |
| 343 if (sender == minimize_button_) { | 348 if (sender == minimize_button_) { |
| 344 frame()->Minimize(); | 349 frame()->Minimize(); |
| 345 } else if (sender == maximize_button_) { | 350 } else if (sender == maximize_button_) { |
| 346 frame()->Maximize(); | 351 frame()->Maximize(); |
| 347 } else if (sender == restore_button_) { | 352 } else if (sender == restore_button_) { |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 | 907 |
| 903 int OpaqueBrowserFrameView::GetTopAreaHeight() const { | 908 int OpaqueBrowserFrameView::GetTopAreaHeight() const { |
| 904 gfx::ImageSkia* frame_image = GetFrameImage(); | 909 gfx::ImageSkia* frame_image = GetFrameImage(); |
| 905 int top_area_height = frame_image->height(); | 910 int top_area_height = frame_image->height(); |
| 906 if (browser_view()->IsTabStripVisible()) { | 911 if (browser_view()->IsTabStripVisible()) { |
| 907 top_area_height = std::max(top_area_height, | 912 top_area_height = std::max(top_area_height, |
| 908 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); | 913 GetBoundsForTabStrip(browser_view()->tabstrip()).bottom()); |
| 909 } | 914 } |
| 910 return top_area_height; | 915 return top_area_height; |
| 911 } | 916 } |
| OLD | NEW |