OLD | NEW |
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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "examples/bitmap_uploader/bitmap_uploader.h" | 10 #include "examples/bitmap_uploader/bitmap_uploader.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void OnViewManagerDisconnected(ViewManager* view_manager) override { | 79 void OnViewManagerDisconnected(ViewManager* view_manager) override { |
80 base::MessageLoop::current()->Quit(); | 80 base::MessageLoop::current()->Quit(); |
81 } | 81 } |
82 | 82 |
83 // Overridden from ViewObserver: | 83 // Overridden from ViewObserver: |
84 void OnViewDestroyed(View* view) override { | 84 void OnViewDestroyed(View* view) override { |
85 DCHECK(windows_.find(view->id()) != windows_.end()); | 85 DCHECK(windows_.find(view->id()) != windows_.end()); |
86 windows_.erase(view->id()); | 86 windows_.erase(view->id()); |
87 } | 87 } |
88 void OnViewInputEvent(View* view, const EventPtr& event) override { | 88 void OnViewInputEvent(View* view, const EventPtr& event) override { |
89 if (event->action == EVENT_TYPE_POINTER_UP && | 89 if (event->action == EventType::POINTER_UP && |
90 (static_cast<uint32_t>(event->flags) & | 90 (static_cast<uint32_t>(event->flags) & |
91 static_cast<uint32_t>(EVENT_FLAGS_LEFT_MOUSE_BUTTON))) { | 91 static_cast<uint32_t>(EventFlags::LEFT_MOUSE_BUTTON))) { |
92 URLRequestPtr request(URLRequest::New()); | 92 URLRequestPtr request(URLRequest::New()); |
93 request->url = "http://www.aaronboodman.com/z_dropbox/test.html"; | 93 request->url = "http://www.aaronboodman.com/z_dropbox/test.html"; |
94 NavigatorHostPtr navigator_host; | 94 NavigatorHostPtr navigator_host; |
95 ConnectToService(windows_[view->id()]->embedder_service_provider.get(), | 95 ConnectToService(windows_[view->id()]->embedder_service_provider.get(), |
96 &navigator_host); | 96 &navigator_host); |
97 navigator_host->RequestNavigate(TARGET_SOURCE_NODE, request.Pass()); | 97 navigator_host->RequestNavigate(Target::SOURCE_NODE, request.Pass()); |
98 } | 98 } |
99 } | 99 } |
100 | 100 |
101 Shell* shell_; | 101 Shell* shell_; |
102 scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; | 102 scoped_ptr<ViewManagerClientFactory> view_manager_client_factory_; |
103 | 103 |
104 typedef std::map<Id, Window*> WindowMap; | 104 typedef std::map<Id, Window*> WindowMap; |
105 WindowMap windows_; | 105 WindowMap windows_; |
106 | 106 |
107 int next_color_; | 107 int next_color_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(EmbeddedApp); | 109 DISALLOW_COPY_AND_ASSIGN(EmbeddedApp); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace examples | 112 } // namespace examples |
113 } // namespace mojo | 113 } // namespace mojo |
114 | 114 |
115 MojoResult MojoMain(MojoHandle application_request) { | 115 MojoResult MojoMain(MojoHandle application_request) { |
116 mojo::ApplicationRunnerChromium runner(new mojo::examples::EmbeddedApp); | 116 mojo::ApplicationRunnerChromium runner(new mojo::examples::EmbeddedApp); |
117 return runner.Run(application_request); | 117 return runner.Run(application_request); |
118 } | 118 } |
OLD | NEW |