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

Side by Side Diff: ui/views/controls/native/native_view_host_aura.cc

Issue 397493005: Make NativeViewHostAura clipping window non-focusable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 | « ui/views/controls/native/native_view_host_aura.h ('k') | 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 "ui/views/controls/native/native_view_host_aura.h" 5 #include "ui/views/controls/native/native_view_host_aura.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/aura/client/aura_constants.h" 8 #include "ui/aura/client/aura_constants.h"
9 #include "ui/aura/client/focus_client.h" 9 #include "ui/aura/client/focus_client.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
11 #include "ui/aura/window_delegate.h"
11 #include "ui/base/cursor/cursor.h" 12 #include "ui/base/cursor/cursor.h"
12 #include "ui/views/controls/native/native_view_host.h" 13 #include "ui/views/controls/native/native_view_host.h"
13 #include "ui/views/view_constants_aura.h" 14 #include "ui/views/view_constants_aura.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 16
16 namespace views { 17 namespace views {
17 18
19 class NativeViewHostAura::ClippingWindowDelegate : public aura::WindowDelegate {
sky 2014/07/15 04:41:12 Would making NavigateViewHostAura an ActivationDel
calamity 2014/07/15 06:35:01 No dice =( It seems that base_focus_rules.cc only
sky 2014/07/15 16:19:39 What about making NativeViewHostAura itself the Wi
20 public:
21 ClippingWindowDelegate() {}
22 ~ClippingWindowDelegate() {}
23
24 virtual gfx::Size GetMinimumSize() const OVERRIDE { return gfx::Size(); }
25 virtual gfx::Size GetMaximumSize() const OVERRIDE { return gfx::Size(); }
26 virtual void OnBoundsChanged(const gfx::Rect& old_bounds,
27 const gfx::Rect& new_bounds) OVERRIDE {}
28 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE {
29 return gfx::kNullCursor;
30 }
31 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE {
32 return HTCLIENT;
33 }
34 virtual bool ShouldDescendIntoChildForEventHandling(
35 aura::Window* child,
36 const gfx::Point& location) OVERRIDE { return true; }
37 virtual bool CanFocus() OVERRIDE { return false; }
38 virtual void OnCaptureLost() OVERRIDE {}
39 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {}
40 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {}
41 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {}
42 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE {}
43 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {}
44 virtual bool HasHitTestMask() const OVERRIDE { return false; }
45 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {}
46 };
47
18 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host) 48 NativeViewHostAura::NativeViewHostAura(NativeViewHost* host)
19 : host_(host), 49 : host_(host),
20 clipping_window_(NULL) { 50 clipping_window_delegate_(new ClippingWindowDelegate()),
51 clipping_window_(clipping_window_delegate_.get()) {
21 clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN); 52 clipping_window_.Init(aura::WINDOW_LAYER_NOT_DRAWN);
22 clipping_window_.set_owned_by_parent(false); 53 clipping_window_.set_owned_by_parent(false);
23 clipping_window_.SetName("NativeViewHostAuraClip"); 54 clipping_window_.SetName("NativeViewHostAuraClip");
24 clipping_window_.layer()->SetMasksToBounds(true); 55 clipping_window_.layer()->SetMasksToBounds(true);
25 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_)); 56 clipping_window_.SetProperty(views::kHostViewKey, static_cast<View*>(host_));
26 } 57 }
27 58
28 NativeViewHostAura::~NativeViewHostAura() { 59 NativeViewHostAura::~NativeViewHostAura() {
29 if (host_->native_view()) { 60 if (host_->native_view()) {
30 host_->native_view()->RemoveObserver(this); 61 host_->native_view()->RemoveObserver(this);
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 clipping_window_.RemoveChild(host_->native_view()); 204 clipping_window_.RemoveChild(host_->native_view());
174 } 205 }
175 host_->native_view()->SetBounds(clipping_window_.bounds()); 206 host_->native_view()->SetBounds(clipping_window_.bounds());
176 } 207 }
177 clipping_window_.Hide(); 208 clipping_window_.Hide();
178 if (clipping_window_.parent()) 209 if (clipping_window_.parent())
179 clipping_window_.parent()->RemoveChild(&clipping_window_); 210 clipping_window_.parent()->RemoveChild(&clipping_window_);
180 } 211 }
181 212
182 } // namespace views 213 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/native/native_view_host_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698