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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 551883002: Deactivate touch selection on transform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 // We have to implement the WindowObserver interface on a separate object 394 // We have to implement the WindowObserver interface on a separate object
395 // because clang doesn't like implementing multiple interfaces that have 395 // because clang doesn't like implementing multiple interfaces that have
396 // methods with the same name. This object is owned by the 396 // methods with the same name. This object is owned by the
397 // RenderWidgetHostViewAura. 397 // RenderWidgetHostViewAura.
398 class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver { 398 class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver {
399 public: 399 public:
400 explicit WindowObserver(RenderWidgetHostViewAura* view) 400 explicit WindowObserver(RenderWidgetHostViewAura* view)
401 : view_(view) { 401 : view_(view) {
402 view_->window_->AddObserver(this); 402 ObserveHierarchy(view_->window_);
403 } 403 }
404 404
405 virtual ~WindowObserver() { 405 virtual ~WindowObserver() {
406 view_->window_->RemoveObserver(this); 406 UnobserveHierarchy(view_->window_);
407 } 407 }
408 408
409 // Overridden from aura::WindowObserver: 409 // Overridden from aura::WindowObserver:
410 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE {
411 if (window->Contains(view_->window_))
412 UnobserveHierarchy(window->parent());
413 }
414
415 virtual void OnWindowParentChanged(aura::Window* window,
416 aura::Window* parent) OVERRIDE {
417 ObserveHierarchy(parent);
418 }
419
410 virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE { 420 virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE {
411 if (window == view_->window_) 421 if (window == view_->window_)
412 view_->AddedToRootWindow(); 422 view_->AddedToRootWindow();
413 } 423 }
414 424
415 virtual void OnWindowRemovingFromRootWindow(aura::Window* window, 425 virtual void OnWindowRemovingFromRootWindow(aura::Window* window,
416 aura::Window* new_root) OVERRIDE { 426 aura::Window* new_root) OVERRIDE {
417 if (window == view_->window_) 427 if (window == view_->window_)
418 view_->RemovingFromRootWindow(); 428 view_->RemovingFromRootWindow();
419 } 429 }
420 430
431 virtual void OnWindowTransformed(aura::Window* window) OVERRIDE {
432 if (view_->touch_editing_client_)
433 view_->touch_editing_client_->EndTouchEditing(true);
434 }
435
421 private: 436 private:
437 void ObserveHierarchy(aura::Window* window) {
438 for (; window; window = window->parent())
sky 2014/09/08 20:24:56 This is going to be fragile and easy to get wrong.
mohsen 2014/09/09 21:36:36 Isn't it going to be costly? E.g. if a transform i
439 window->AddObserver(this);
440 }
441
442 void UnobserveHierarchy(aura::Window* window) {
443 for (; window; window = window->parent())
444 window->RemoveObserver(this);
445 }
446
422 RenderWidgetHostViewAura* view_; 447 RenderWidgetHostViewAura* view_;
423 448
424 DISALLOW_COPY_AND_ASSIGN(WindowObserver); 449 DISALLOW_COPY_AND_ASSIGN(WindowObserver);
425 }; 450 };
426 451
427 //////////////////////////////////////////////////////////////////////////////// 452 ////////////////////////////////////////////////////////////////////////////////
428 // RenderWidgetHostViewAura, public: 453 // RenderWidgetHostViewAura, public:
429 454
430 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) 455 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host)
431 : host_(RenderWidgetHostImpl::From(host)), 456 : host_(RenderWidgetHostImpl::From(host)),
(...skipping 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 2519
2495 //////////////////////////////////////////////////////////////////////////////// 2520 ////////////////////////////////////////////////////////////////////////////////
2496 // RenderWidgetHostViewBase, public: 2521 // RenderWidgetHostViewBase, public:
2497 2522
2498 // static 2523 // static
2499 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2524 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2500 GetScreenInfoForWindow(results, NULL); 2525 GetScreenInfoForWindow(results, NULL);
2501 } 2526 }
2502 2527
2503 } // namespace content 2528 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698