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

Side by Side Diff: chrome/browser/ui/views/tabs/window_finder_mus.cc

Issue 2449103004: Refactor WindowFinder definition (Closed)
Patch Set: addressed more remarks from sky Created 4 years, 1 month 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/tabs/window_finder_mus.h" 5 #include "chrome/browser/ui/views/tabs/window_finder_mus.h"
6 6
7 #include "content/public/common/service_manager_connection.h" // nogncheck
8 #include "services/service_manager/runner/common/client_util.h" // nogncheck
7 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
8 #include "ui/views/mus/native_widget_mus.h" 10 #include "ui/views/mus/native_widget_mus.h"
9 #include "ui/views/mus/window_manager_connection.h" 11 #include "ui/views/mus/window_manager_connection.h"
10 12
11 WindowFinderMus::WindowFinderMus() {} 13 bool GetLocalProcessWindowAtPointMus(
14 const gfx::Point& screen_point,
15 const std::set<gfx::NativeWindow>& ignore,
16 gfx::NativeWindow* mus_result) {
17 content::ServiceManagerConnection* service_manager_connection =
sky 2016/11/01 15:07:38 For safety set mus_result to null early on.
tonikitoo 2016/11/01 15:16:39 Done.
18 content::ServiceManagerConnection::GetForProcess();
19 if (!service_manager_connection || !service_manager::ServiceManagerIsRemote())
20 return false;
12 21
13 WindowFinderMus::~WindowFinderMus() {}
14
15 gfx::NativeWindow WindowFinderMus::GetLocalProcessWindowAtPoint(
16 const gfx::Point& screen_point,
17 const std::set<gfx::NativeWindow>& ignore) {
18 std::set<ui::Window*> mus_windows = 22 std::set<ui::Window*> mus_windows =
19 views::WindowManagerConnection::Get()->GetRoots(); 23 views::WindowManagerConnection::Get()->GetRoots();
20 // TODO(erg): Needs to deal with stacking order here. 24 // TODO(erg): Needs to deal with stacking order here.
21 25
22 // For every mus window, look at the associated aura window and see if we're 26 // For every mus window, look at the associated aura window and see if we're
23 // in that. 27 // in that.
24 for (ui::Window* mus : mus_windows) { 28 for (ui::Window* mus : mus_windows) {
25 views::Widget* widget = views::NativeWidgetMus::GetWidgetForWindow(mus); 29 views::Widget* widget = views::NativeWidgetMus::GetWidgetForWindow(mus);
26 if (widget && widget->GetWindowBoundsInScreen().Contains(screen_point)) { 30 if (widget && widget->GetWindowBoundsInScreen().Contains(screen_point)) {
27 aura::Window* content_window = widget->GetNativeWindow(); 31 aura::Window* content_window = widget->GetNativeWindow();
28 32
29 // If we were instructed to ignore this window, ignore it. 33 // If we were instructed to ignore this window, ignore it.
30 if (base::ContainsKey(ignore, content_window)) 34 if (base::ContainsKey(ignore, content_window))
31 continue; 35 continue;
32 36
33 return content_window; 37 *mus_result = content_window;
38 return true;
34 } 39 }
35 } 40 }
36 41
37 return nullptr; 42 return true;
38 } 43 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/window_finder_mus.h ('k') | chrome/browser/ui/views/tabs/window_finder_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698