| 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 "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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // and dismiss the popup for certain events. | 345 // and dismiss the popup for certain events. |
| 346 class RenderWidgetHostViewAura::EventFilterForPopupExit | 346 class RenderWidgetHostViewAura::EventFilterForPopupExit |
| 347 : public ui::EventHandler { | 347 : public ui::EventHandler { |
| 348 public: | 348 public: |
| 349 explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva) | 349 explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva) |
| 350 : rwhva_(rwhva) { | 350 : rwhva_(rwhva) { |
| 351 DCHECK(rwhva_); | 351 DCHECK(rwhva_); |
| 352 aura::Env::GetInstance()->AddPreTargetHandler(this); | 352 aura::Env::GetInstance()->AddPreTargetHandler(this); |
| 353 } | 353 } |
| 354 | 354 |
| 355 virtual ~EventFilterForPopupExit() { | 355 ~EventFilterForPopupExit() override { |
| 356 aura::Env::GetInstance()->RemovePreTargetHandler(this); | 356 aura::Env::GetInstance()->RemovePreTargetHandler(this); |
| 357 } | 357 } |
| 358 | 358 |
| 359 // Overridden from ui::EventHandler | 359 // Overridden from ui::EventHandler |
| 360 virtual void OnMouseEvent(ui::MouseEvent* event) override { | 360 void OnMouseEvent(ui::MouseEvent* event) override { |
| 361 rwhva_->ApplyEventFilterForPopupExit(event); | 361 rwhva_->ApplyEventFilterForPopupExit(event); |
| 362 } | 362 } |
| 363 | 363 |
| 364 virtual void OnTouchEvent(ui::TouchEvent* event) override { | 364 void OnTouchEvent(ui::TouchEvent* event) override { |
| 365 rwhva_->ApplyEventFilterForPopupExit(event); | 365 rwhva_->ApplyEventFilterForPopupExit(event); |
| 366 } | 366 } |
| 367 | 367 |
| 368 private: | 368 private: |
| 369 RenderWidgetHostViewAura* rwhva_; | 369 RenderWidgetHostViewAura* rwhva_; |
| 370 | 370 |
| 371 DISALLOW_COPY_AND_ASSIGN(EventFilterForPopupExit); | 371 DISALLOW_COPY_AND_ASSIGN(EventFilterForPopupExit); |
| 372 }; | 372 }; |
| 373 | 373 |
| 374 void RenderWidgetHostViewAura::ApplyEventFilterForPopupExit( | 374 void RenderWidgetHostViewAura::ApplyEventFilterForPopupExit( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 396 // because clang doesn't like implementing multiple interfaces that have | 396 // because clang doesn't like implementing multiple interfaces that have |
| 397 // methods with the same name. This object is owned by the | 397 // methods with the same name. This object is owned by the |
| 398 // RenderWidgetHostViewAura. | 398 // RenderWidgetHostViewAura. |
| 399 class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver { | 399 class RenderWidgetHostViewAura::WindowObserver : public aura::WindowObserver { |
| 400 public: | 400 public: |
| 401 explicit WindowObserver(RenderWidgetHostViewAura* view) | 401 explicit WindowObserver(RenderWidgetHostViewAura* view) |
| 402 : view_(view) { | 402 : view_(view) { |
| 403 view_->window_->AddObserver(this); | 403 view_->window_->AddObserver(this); |
| 404 } | 404 } |
| 405 | 405 |
| 406 virtual ~WindowObserver() { | 406 ~WindowObserver() override { view_->window_->RemoveObserver(this); } |
| 407 view_->window_->RemoveObserver(this); | |
| 408 } | |
| 409 | 407 |
| 410 // Overridden from aura::WindowObserver: | 408 // Overridden from aura::WindowObserver: |
| 411 virtual void OnWindowAddedToRootWindow(aura::Window* window) override { | 409 void OnWindowAddedToRootWindow(aura::Window* window) override { |
| 412 if (window == view_->window_) | 410 if (window == view_->window_) |
| 413 view_->AddedToRootWindow(); | 411 view_->AddedToRootWindow(); |
| 414 } | 412 } |
| 415 | 413 |
| 416 virtual void OnWindowRemovingFromRootWindow(aura::Window* window, | 414 void OnWindowRemovingFromRootWindow(aura::Window* window, |
| 417 aura::Window* new_root) override { | 415 aura::Window* new_root) override { |
| 418 if (window == view_->window_) | 416 if (window == view_->window_) |
| 419 view_->RemovingFromRootWindow(); | 417 view_->RemovingFromRootWindow(); |
| 420 } | 418 } |
| 421 | 419 |
| 422 private: | 420 private: |
| 423 RenderWidgetHostViewAura* view_; | 421 RenderWidgetHostViewAura* view_; |
| 424 | 422 |
| 425 DISALLOW_COPY_AND_ASSIGN(WindowObserver); | 423 DISALLOW_COPY_AND_ASSIGN(WindowObserver); |
| 426 }; | 424 }; |
| 427 | 425 |
| (...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2615 | 2613 |
| 2616 //////////////////////////////////////////////////////////////////////////////// | 2614 //////////////////////////////////////////////////////////////////////////////// |
| 2617 // RenderWidgetHostViewBase, public: | 2615 // RenderWidgetHostViewBase, public: |
| 2618 | 2616 |
| 2619 // static | 2617 // static |
| 2620 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2618 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2621 GetScreenInfoForWindow(results, NULL); | 2619 GetScreenInfoForWindow(results, NULL); |
| 2622 } | 2620 } |
| 2623 | 2621 |
| 2624 } // namespace content | 2622 } // namespace content |
| OLD | NEW |