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

Side by Side Diff: mojo/services/window_manager/window_manager_service_impl.cc

Issue 405523002: Add ability APIs for opening a window with a url embedded, focusing and activating a window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/services/window_manager/window_manager_service_impl.h" 5 #include "mojo/services/window_manager/window_manager_service_impl.h"
6 6
7 #include "mojo/services/window_manager/window_manager_app.h" 7 #include "mojo/services/window_manager/window_manager_app.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 10
11 //////////////////////////////////////////////////////////////////////////////// 11 ////////////////////////////////////////////////////////////////////////////////
12 // WindowManagerServiceImpl, public: 12 // WindowManagerServiceImpl, public:
13 13
14 WindowManagerServiceImpl::WindowManagerServiceImpl( 14 WindowManagerServiceImpl::WindowManagerServiceImpl(
15 ApplicationConnection* connection, 15 ApplicationConnection* connection,
16 WindowManagerApp* window_manager) 16 WindowManagerApp* window_manager)
17 : window_manager_(window_manager) { 17 : window_manager_(window_manager) {
18 window_manager_->AddConnection(this); 18 window_manager_->AddConnection(this);
19 } 19 }
20 20
21 WindowManagerServiceImpl::~WindowManagerServiceImpl() { 21 WindowManagerServiceImpl::~WindowManagerServiceImpl() {
22 window_manager_->RemoveConnection(this); 22 window_manager_->RemoveConnection(this);
23 } 23 }
24 24
25 void WindowManagerServiceImpl::NotifyReady() { 25 void WindowManagerServiceImpl::NotifyReady() {
26 client()->OnWindowManagerReady(); 26 client()->OnWindowManagerReady();
27 } 27 }
28 28
29 void WindowManagerServiceImpl::NotifyNodeFocused(
30 view_manager::Id new_focused_id,
31 view_manager::Id old_focused_id) {
32 client()->OnFocusChanged(old_focused_id, new_focused_id);
33 }
34
35 void WindowManagerServiceImpl::NotifyWindowActivated(
36 view_manager::Id new_active_id,
37 view_manager::Id old_active_id) {
38 client()->OnActiveWindowChanged(old_active_id, new_active_id);
39 }
40
29 //////////////////////////////////////////////////////////////////////////////// 41 ////////////////////////////////////////////////////////////////////////////////
30 // WindowManagerServiceImpl, WindowManager implementation: 42 // WindowManagerServiceImpl, WindowManager implementation:
31 43
32 void WindowManagerServiceImpl::OpenWindow( 44 void WindowManagerServiceImpl::OpenWindow(
33 const Callback<void(view_manager::Id)>& callback) { 45 const Callback<void(view_manager::Id)>& callback) {
34 view_manager::Id id = window_manager_->OpenWindow(); 46 view_manager::Id id = window_manager_->OpenWindow();
35 callback.Run(id); 47 callback.Run(id);
36 } 48 }
37 49
50 void WindowManagerServiceImpl::OpenWindowWithURL(
51 const String& url,
52 const Callback<void(view_manager::Id)>& callback) {
53 view_manager::Id id = window_manager_->OpenWindowWithURL(url);
54 callback.Run(id);
55 }
56
38 void WindowManagerServiceImpl::SetCapture( 57 void WindowManagerServiceImpl::SetCapture(
39 view_manager::Id node, 58 view_manager::Id node,
40 const Callback<void(bool)>& callback) { 59 const Callback<void(bool)>& callback) {
41 window_manager_->SetCapture(node); 60 window_manager_->SetCapture(node);
42 callback.Run(true); 61 callback.Run(true);
43 } 62 }
44 63
64 void WindowManagerServiceImpl::FocusWindow(
65 view_manager::Id node,
66 const Callback<void(bool)>& callback) {
67 window_manager_->FocusWindow(node);
68 callback.Run(true);
69 }
70
71 void WindowManagerServiceImpl::ActivateWindow(
72 view_manager::Id node,
73 const Callback<void(bool)>& callback) {
74 window_manager_->ActivateWindow(node);
75 callback.Run(true);
76 }
77
45 //////////////////////////////////////////////////////////////////////////////// 78 ////////////////////////////////////////////////////////////////////////////////
46 // WindowManagerServiceImpl, InterfaceImpl overrides: 79 // WindowManagerServiceImpl, InterfaceImpl overrides:
47 80
48 void WindowManagerServiceImpl::OnConnectionEstablished() { 81 void WindowManagerServiceImpl::OnConnectionEstablished() {
49 // If the connection was established prior to the window manager being 82 // If the connection was established prior to the window manager being
50 // embedded by the view manager, |window_manager_|'s ViewManagerDelegate 83 // embedded by the view manager, |window_manager_|'s ViewManagerDelegate
51 // impl will call NotifyReady() when it is. 84 // impl will call NotifyReady() when it is.
52 if (window_manager_->IsReady()) 85 if (window_manager_->IsReady())
53 NotifyReady(); 86 NotifyReady();
54 } 87 }
55 88
56 } // namespace mojo 89 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698