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

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

Issue 22891016: Add support for rect-based event targeting in views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 7 years, 3 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) 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/browser_non_client_frame_view_ash.h" 5 #include "chrome/browser/ui/views/frame/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_caption_button_container_view.h" 8 #include "ash/wm/workspace/frame_caption_button_container_view.h"
9 #include "chrome/browser/themes/theme_properties.h" 9 #include "chrome/browser/themes/theme_properties.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 const char* BrowserNonClientFrameViewAsh::GetClassName() const { 256 const char* BrowserNonClientFrameViewAsh::GetClassName() const {
257 return kViewClassName; 257 return kViewClassName;
258 } 258 }
259 259
260 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const { 260 bool BrowserNonClientFrameViewAsh::HitTestRect(const gfx::Rect& rect) const {
261 if (!views::View::HitTestRect(rect)) { 261 if (!views::View::HitTestRect(rect)) {
262 // |rect| is outside BrowserNonClientFrameViewAsh's bounds. 262 // |rect| is outside BrowserNonClientFrameViewAsh's bounds.
263 return false; 263 return false;
264 } 264 }
265 // If the rect is outside the bounds of the client area, claim it. 265 // If the rect is outside the bounds of the client area, claim it.
266 // TODO(tdanderson): Implement View::ConvertRectToTarget(). 266 gfx::Rect rect_in_client_view_coords(rect);
267 gfx::Point rect_in_client_view_coords_origin(rect.origin()); 267 View::ConvertRectToTarget(this, frame()->client_view(),
268 View::ConvertPointToTarget(this, frame()->client_view(), 268 &rect_in_client_view_coords);
269 &rect_in_client_view_coords_origin);
270 gfx::Rect rect_in_client_view_coords(
271 rect_in_client_view_coords_origin, rect.size());
272 if (!frame()->client_view()->HitTestRect(rect_in_client_view_coords)) 269 if (!frame()->client_view()->HitTestRect(rect_in_client_view_coords))
273 return true; 270 return true;
274 271
275 // Otherwise, claim |rect| only if it is above the bottom of the tabstrip in 272 // Otherwise, claim |rect| only if it is above the bottom of the tabstrip in
276 // a non-tab portion. 273 // a non-tab portion.
277 TabStrip* tabstrip = browser_view()->tabstrip(); 274 TabStrip* tabstrip = browser_view()->tabstrip();
278 if (!tabstrip || !browser_view()->IsTabStripVisible()) 275 if (!tabstrip || !browser_view()->IsTabStripVisible())
279 return false; 276 return false;
280 277
281 gfx::Point rect_in_tabstrip_coords_origin(rect.origin()); 278 gfx::Rect rect_in_tabstrip_coords(rect);
282 View::ConvertPointToTarget(this, tabstrip, 279 View::ConvertRectToTarget(this, tabstrip, &rect_in_tabstrip_coords);
283 &rect_in_tabstrip_coords_origin);
284 gfx::Rect rect_in_tabstrip_coords(rect_in_tabstrip_coords_origin,
285 rect.size());
286 280
287 if (rect_in_tabstrip_coords.bottom() > tabstrip->GetLocalBounds().bottom()) { 281 if (rect_in_tabstrip_coords.y() > tabstrip->GetLocalBounds().bottom()) {
288 // |rect| is below the tabstrip. 282 // |rect| is below the tabstrip.
289 return false; 283 return false;
290 } 284 }
291 285
292 if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) { 286 if (tabstrip->HitTestRect(rect_in_tabstrip_coords)) {
293 // Claim |rect| if it is in a non-tab portion of the tabstrip. 287 // Claim |rect| if it is in a non-tab portion of the tabstrip.
294 // TODO(tdanderson): Pass |rect_in_tabstrip_coords| instead of its center 288 return tabstrip->IsRectInWindowCaption(rect_in_tabstrip_coords);
295 // point to TabStrip::IsPositionInWindowCaption() once
296 // GetEventHandlerForRect() is implemented.
297 return tabstrip->IsPositionInWindowCaption(
298 rect_in_tabstrip_coords.CenterPoint());
299 } 289 }
300 290
301 // We claim |rect| because it is above the bottom of the tabstrip, but 291 // We claim |rect| because it is above the bottom of the tabstrip, but
302 // not in the tabstrip. In particular, the window controls are right of 292 // not in the tabstrip. In particular, the window controls are right of
303 // the tabstrip. 293 // the tabstrip.
304 return true; 294 return true;
305 } 295 }
306 296
307 void BrowserNonClientFrameViewAsh::GetAccessibleState( 297 void BrowserNonClientFrameViewAsh::GetAccessibleState(
308 ui::AccessibleViewState* state) { 298 ui::AccessibleViewState* state) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const { 528 int BrowserNonClientFrameViewAsh::GetThemeFrameOverlayImageId() const {
539 ui::ThemeProvider* tp = GetThemeProvider(); 529 ui::ThemeProvider* tp = GetThemeProvider();
540 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && 530 if (tp->HasCustomImage(IDR_THEME_FRAME_OVERLAY) &&
541 browser_view()->IsBrowserTypeNormal() && 531 browser_view()->IsBrowserTypeNormal() &&
542 !browser_view()->IsOffTheRecord()) { 532 !browser_view()->IsOffTheRecord()) {
543 return ShouldPaintAsActive() ? 533 return ShouldPaintAsActive() ?
544 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE; 534 IDR_THEME_FRAME_OVERLAY : IDR_THEME_FRAME_OVERLAY_INACTIVE;
545 } 535 }
546 return 0; 536 return 0;
547 } 537 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/opaque_browser_frame_view.cc » ('j') | chrome/browser/ui/views/tabs/tab_strip.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698