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

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

Issue 333173003: Mojo: Fix DCHECK on middle-click in window manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | 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 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/bind.h" 6 #include "base/bind.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.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.h" 9 #include "mojo/public/cpp/application/application.h"
10 #include "mojo/services/public/cpp/view_manager/node.h" 10 #include "mojo/services/public/cpp/view_manager/node.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 // Overridden from ViewObserver: 111 // Overridden from ViewObserver:
112 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { 112 virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE {
113 if (event->action == ui::ET_MOUSE_RELEASED) { 113 if (event->action == ui::ET_MOUSE_RELEASED) {
114 std::string app_url; 114 std::string app_url;
115 if (event->flags & ui::EF_LEFT_MOUSE_BUTTON) 115 if (event->flags & ui::EF_LEFT_MOUSE_BUTTON)
116 app_url = "mojo://mojo_embedded_app"; 116 app_url = "mojo://mojo_embedded_app";
117 else if (event->flags & ui::EF_RIGHT_MOUSE_BUTTON) 117 else if (event->flags & ui::EF_RIGHT_MOUSE_BUTTON)
118 app_url = "mojo://mojo_nesting_app"; 118 app_url = "mojo://mojo_nesting_app";
119 DCHECK(!app_url.empty()); 119 if (app_url.empty())
120 return;
120 121
121 Node* node = view_manager_->GetNodeById(parent_node_id_); 122 Node* node = view_manager_->GetNodeById(parent_node_id_);
122 navigation::NavigationDetailsPtr nav_details( 123 navigation::NavigationDetailsPtr nav_details(
123 navigation::NavigationDetails::New()); 124 navigation::NavigationDetails::New());
124 size_t index = node->children().size() - 1; 125 size_t index = node->children().size() - 1;
125 nav_details->url = base::StringPrintf( 126 nav_details->url = base::StringPrintf(
126 "%s/%x", app_url.c_str(), kColors[index % arraysize(kColors)]); 127 "%s/%x", app_url.c_str(), kColors[index % arraysize(kColors)]);
127 navigation::ResponseDetailsPtr response; 128 navigation::ResponseDetailsPtr response;
128 CreateWindow(app_url, nav_details.Pass(), response.Pass()); 129 CreateWindow(app_url, nav_details.Pass(), response.Pass());
129 } 130 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 } 217 }
217 218
218 } // namespace examples 219 } // namespace examples
219 220
220 // static 221 // static
221 Application* Application::Create() { 222 Application* Application::Create() {
222 return new examples::WindowManager; 223 return new examples::WindowManager;
223 } 224 }
224 225
225 } // namespace mojo 226 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698