| 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "mojo/examples/window_manager/window_manager.mojom.h" | 9 #include "mojo/examples/window_manager/window_manager.mojom.h" |
| 10 #include "mojo/public/cpp/application/application.h" | 10 #include "mojo/public/cpp/application/application.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void SetNodeColor(uint32 node_id, SkColor color) { | 42 void SetNodeColor(uint32 node_id, SkColor color) { |
| 43 pending_node_colors_[node_id] = color; | 43 pending_node_colors_[node_id] = color; |
| 44 ProcessPendingNodeColor(node_id); | 44 ProcessPendingNodeColor(node_id); |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 class Navigator : public InterfaceImpl<navigation::Navigator> { | 48 class Navigator : public InterfaceImpl<navigation::Navigator> { |
| 49 public: | 49 public: |
| 50 explicit Navigator(EmbeddedApp* app) : app_(app) {} | 50 explicit Navigator(EmbeddedApp* app) : app_(app) {} |
| 51 private: | 51 private: |
| 52 virtual void Navigate(uint32 node_id, | 52 virtual void Navigate( |
| 53 navigation::NavigationDetailsPtr details) OVERRIDE { | 53 uint32 node_id, |
| 54 GURL url(details->url.To<std::string>()); | 54 navigation::NavigationDetailsPtr navigation_details, |
| 55 navigation::ResponseDetailsPtr response_details) OVERRIDE { |
| 56 GURL url(navigation_details->url.To<std::string>()); |
| 55 if (!url.is_valid()) { | 57 if (!url.is_valid()) { |
| 56 LOG(ERROR) << "URL is invalid."; | 58 LOG(ERROR) << "URL is invalid."; |
| 57 return; | 59 return; |
| 58 } | 60 } |
| 59 // TODO(aa): Verify new URL is same origin as current origin. | 61 // TODO(aa): Verify new URL is same origin as current origin. |
| 60 SkColor color = 0x00; | 62 SkColor color = 0x00; |
| 61 if (!base::HexStringToUInt(url.path().substr(1), &color)) { | 63 if (!base::HexStringToUInt(url.path().substr(1), &color)) { |
| 62 LOG(ERROR) << "Invalid URL, path not convertible to integer"; | 64 LOG(ERROR) << "Invalid URL, path not convertible to integer"; |
| 63 return; | 65 return; |
| 64 } | 66 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 }; | 146 }; |
| 145 | 147 |
| 146 } // namespace examples | 148 } // namespace examples |
| 147 | 149 |
| 148 // static | 150 // static |
| 149 Application* Application::Create() { | 151 Application* Application::Create() { |
| 150 return new examples::EmbeddedApp; | 152 return new examples::EmbeddedApp; |
| 151 } | 153 } |
| 152 | 154 |
| 153 } // namespace mojo | 155 } // namespace mojo |
| OLD | NEW |