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

Side by Side Diff: mojo/examples/browser/browser.cc

Issue 383123006: Preliminary interactive layout of window manager's demo_launcher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Looks Good 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
« no previous file with comments | « no previous file | mojo/examples/html_viewer/html_document_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "mojo/examples/window_manager/window_manager.mojom.h" 8 #include "mojo/examples/window_manager/window_manager.mojom.h"
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/application/application_delegate.h" 10 #include "mojo/public/cpp/application/application_delegate.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // This is the basics of creating a views widget with a textfield. 147 // This is the basics of creating a views widget with a textfield.
148 // TODO: cleanup! 148 // TODO: cleanup!
149 class Browser : public ApplicationDelegate, 149 class Browser : public ApplicationDelegate,
150 public view_manager::ViewManagerDelegate, 150 public view_manager::ViewManagerDelegate,
151 public views::TextfieldController, 151 public views::TextfieldController,
152 public view_manager::NodeObserver { 152 public view_manager::NodeObserver {
153 public: 153 public:
154 Browser() : view_manager_(NULL), root_(NULL), widget_(NULL) {} 154 Browser() : view_manager_(NULL), root_(NULL), widget_(NULL) {}
155 155
156 virtual ~Browser() { 156 virtual ~Browser() {
157 if (root_)
158 root_->RemoveObserver(this);
157 } 159 }
158 160
159 private: 161 private:
160 // Overridden from ApplicationDelegate: 162 // Overridden from ApplicationDelegate:
161 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { 163 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE {
162 views_init_.reset(new ViewsInit); 164 views_init_.reset(new ViewsInit);
163 app->ConnectToService("mojo:mojo_window_manager", &navigator_host_); 165 app->ConnectToService("mojo:mojo_window_manager", &navigator_host_);
164 app->ConnectToService("mojo:mojo_window_manager", &window_manager_); 166 app->ConnectToService("mojo:mojo_window_manager", &window_manager_);
165 } 167 }
166 168
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 aura::client::FocusClient* focus_client = 236 aura::client::FocusClient* focus_client =
235 aura::client::GetFocusClient(widget_->GetNativeView()); 237 aura::client::GetFocusClient(widget_->GetNativeView());
236 if (lost_focus == root_) 238 if (lost_focus == root_)
237 focus_client->FocusWindow(NULL); 239 focus_client->FocusWindow(NULL);
238 else if (gained_focus == root_) 240 else if (gained_focus == root_)
239 focus_client->FocusWindow(widget_->GetNativeView()); 241 focus_client->FocusWindow(widget_->GetNativeView());
240 } 242 }
241 virtual void OnNodeDestroyed(view_manager::Node* node) OVERRIDE { 243 virtual void OnNodeDestroyed(view_manager::Node* node) OVERRIDE {
242 DCHECK_EQ(root_, node); 244 DCHECK_EQ(root_, node);
243 node->RemoveObserver(this); 245 node->RemoveObserver(this);
246 root_ = NULL;
244 } 247 }
245 248
246 scoped_ptr<ViewsInit> views_init_; 249 scoped_ptr<ViewsInit> views_init_;
247 250
248 view_manager::ViewManager* view_manager_; 251 view_manager::ViewManager* view_manager_;
249 view_manager::Node* root_; 252 view_manager::Node* root_;
250 views::Widget* widget_; 253 views::Widget* widget_;
251 navigation::NavigatorHostPtr navigator_host_; 254 navigation::NavigatorHostPtr navigator_host_;
252 IWindowManagerPtr window_manager_; 255 IWindowManagerPtr window_manager_;
253 256
254 DISALLOW_COPY_AND_ASSIGN(Browser); 257 DISALLOW_COPY_AND_ASSIGN(Browser);
255 }; 258 };
256 259
257 } // namespace examples 260 } // namespace examples
258 261
259 // static 262 // static
260 ApplicationDelegate* ApplicationDelegate::Create() { 263 ApplicationDelegate* ApplicationDelegate::Create() {
261 return new examples::Browser; 264 return new examples::Browser;
262 } 265 }
263 266
264 } // namespace mojo 267 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/examples/html_viewer/html_document_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698