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/ash/browser_non_client_frame_view_ash.h" | 5 #include "chrome/browser/ui/views/ash/browser_non_client_frame_view_ash.h" |
6 | 6 |
7 #include "ash/wm/frame_painter.h" | 7 #include "ash/wm/frame_painter.h" |
8 #include "ash/wm/workspace/frame_maximize_button.h" | 8 #include "ash/wm/workspace/frame_maximize_button.h" |
9 #include "chrome/browser/themes/theme_service.h" | 9 #include "chrome/browser/themes/theme_service.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 frame_painter_->LayoutHeader(this, UseShortHeader()); | 321 frame_painter_->LayoutHeader(this, UseShortHeader()); |
322 if (avatar_button()) | 322 if (avatar_button()) |
323 LayoutAvatar(); | 323 LayoutAvatar(); |
324 BrowserNonClientFrameView::Layout(); | 324 BrowserNonClientFrameView::Layout(); |
325 } | 325 } |
326 | 326 |
327 std::string BrowserNonClientFrameViewAsh::GetClassName() const { | 327 std::string BrowserNonClientFrameViewAsh::GetClassName() const { |
328 return kViewClassName; | 328 return kViewClassName; |
329 } | 329 } |
330 | 330 |
331 bool BrowserNonClientFrameViewAsh::HitTest(const gfx::Point& l) const { | 331 bool BrowserNonClientFrameViewAsh::HitTest(const gfx::Rect& r) const { |
332 // If the point is outside the bounds of the client area, claim it. | 332 // If the point is outside the bounds of the client area, claim it. |
333 if (NonClientFrameView::HitTest(l)) | 333 if (NonClientFrameView::HitTest(r)) |
334 return true; | 334 return true; |
335 | 335 |
336 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. | 336 // Otherwise claim it only if it's in a non-tab portion of the tabstrip. |
337 if (!browser_view()->tabstrip()) | 337 if (!browser_view()->tabstrip()) |
338 return false; | 338 return false; |
339 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); | 339 gfx::Rect tabstrip_bounds(browser_view()->tabstrip()->bounds()); |
340 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); | 340 gfx::Point tabstrip_origin(tabstrip_bounds.origin()); |
341 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin); | 341 View::ConvertPointToView(frame()->client_view(), this, &tabstrip_origin); |
342 tabstrip_bounds.set_origin(tabstrip_origin); | 342 tabstrip_bounds.set_origin(tabstrip_origin); |
343 if (l.y() > tabstrip_bounds.bottom()) | 343 if (r.y() > tabstrip_bounds.bottom()) |
tdanderson
2012/08/07 16:18:28
Should this instead be r.y() + r.height() ?
sky
2012/08/07 20:11:43
Yes, I believe it should be r.bottom().
tdanderson
2012/08/08 23:47:51
Done.
| |
344 return false; | 344 return false; |
345 | 345 |
346 // We convert from our parent's coordinates since we assume we fill its bounds | 346 // We convert from our parent's coordinates since we assume we fill its bounds |
347 // completely. We need to do this since we're not a parent of the tabstrip, | 347 // completely. We need to do this since we're not a parent of the tabstrip, |
348 // meaning ConvertPointToView would otherwise return something bogus. | 348 // meaning ConvertPointToView would otherwise return something bogus. |
349 gfx::Point browser_view_point(l); | 349 gfx::Point browser_view_point(gfx::Point(r.x(), r.y())); |
sky
2012/08/07 20:11:43
I don't think this is right here, it only tests th
tdanderson
2012/08/08 23:47:51
I passed in the center point since TabStrip::IsPos
sky
2012/08/09 00:30:14
Can you add a TODO then so that you don't miss upd
tdanderson
2012/08/09 16:16:46
I have added a TODO(tdanderson) for now and will u
| |
350 View::ConvertPointToView(parent(), browser_view(), &browser_view_point); | 350 View::ConvertPointToView(parent(), browser_view(), &browser_view_point); |
351 return browser_view()->IsPositionInWindowCaption(browser_view_point); | 351 return browser_view()->IsPositionInWindowCaption(browser_view_point); |
352 } | 352 } |
353 | 353 |
354 void BrowserNonClientFrameViewAsh::GetAccessibleState( | 354 void BrowserNonClientFrameViewAsh::GetAccessibleState( |
355 ui::AccessibleViewState* state) { | 355 ui::AccessibleViewState* state) { |
356 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; | 356 state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; |
357 } | 357 } |
358 | 358 |
359 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { | 359 gfx::Size BrowserNonClientFrameViewAsh::GetMinimumSize() { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { | 599 BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImage() const { |
600 ui::ThemeProvider* tp = GetThemeProvider(); | 600 ui::ThemeProvider* tp = GetThemeProvider(); |
601 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 601 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
602 browser_view()->IsBrowserTypeNormal() && | 602 browser_view()->IsBrowserTypeNormal() && |
603 !browser_view()->IsOffTheRecord()) { | 603 !browser_view()->IsOffTheRecord()) { |
604 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? | 604 return tp->GetImageSkiaNamed(ShouldPaintAsActive() ? |
605 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); | 605 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE); |
606 } | 606 } |
607 return NULL; | 607 return NULL; |
608 } | 608 } |
OLD | NEW |