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

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

Issue 944763002: Make Page Visibility API work when the browser window is visible or not Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove the VisibilityNotify event handler Created 5 years, 10 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
(...skipping 27 matching lines...) Expand all
38 return type != rhs.type || window != rhs.window || bounds != rhs.bounds; 38 return type != rhs.type || window != rhs.window || bounds != rhs.bounds;
39 } 39 }
40 }; 40 };
41 41
42 NativeViewHostWindowObserver() {} 42 NativeViewHostWindowObserver() {}
43 ~NativeViewHostWindowObserver() override {} 43 ~NativeViewHostWindowObserver() override {}
44 44
45 const std::vector<EventDetails>& events() const { return events_; } 45 const std::vector<EventDetails>& events() const { return events_; }
46 46
47 // aura::WindowObserver overrides 47 // aura::WindowObserver overrides
48 void OnWindowVisibilityChanged(aura::Window* window, bool visible) override { 48 void OnWindowVisibilityChanged(aura::Window* window, bool visible,
49 bool content_visible) override {
49 EventDetails event; 50 EventDetails event;
50 event.type = visible ? EVENT_SHOWN : EVENT_HIDDEN; 51 event.type = visible ? EVENT_SHOWN : EVENT_HIDDEN;
51 event.window = window; 52 event.window = window;
52 event.bounds = window->GetBoundsInRootWindow(); 53 event.bounds = window->GetBoundsInRootWindow();
53 54
54 // Dedupe events as a single Hide() call can result in several 55 // Dedupe events as a single Hide() call can result in several
55 // notifications. 56 // notifications.
56 if (events_.size() == 0u || events_.back() != event) 57 if (events_.size() == 0u || events_.back() != event)
57 events_.push_back(event); 58 events_.push_back(event);
58 } 59 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 341
341 host()->SetVisible(false); 342 host()->SetVisible(false);
342 EXPECT_FALSE(clipping_window()->IsVisible()); 343 EXPECT_FALSE(clipping_window()->IsVisible());
343 EXPECT_FALSE(child()->IsVisible()); 344 EXPECT_FALSE(child()->IsVisible());
344 345
345 DestroyHost(); 346 DestroyHost();
346 DestroyTopLevel(); 347 DestroyTopLevel();
347 } 348 }
348 349
349 } // namespace views 350 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698