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

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

Issue 413353002: Remove extraneous namespaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
9 #include "mojo/examples/media_viewer/media_viewer.mojom.h" 9 #include "mojo/examples/media_viewer/media_viewer.mojom.h"
10 #include "mojo/public/cpp/application/application_connection.h" 10 #include "mojo/public/cpp/application/application_connection.h"
(...skipping 29 matching lines...) Expand all
40 // Overridden from ZoomableMedia: 40 // Overridden from ZoomableMedia:
41 virtual void ZoomIn() OVERRIDE; 41 virtual void ZoomIn() OVERRIDE;
42 virtual void ZoomOut() OVERRIDE; 42 virtual void ZoomOut() OVERRIDE;
43 virtual void ZoomToActualSize() OVERRIDE; 43 virtual void ZoomToActualSize() OVERRIDE;
44 44
45 PNGViewer* viewer_; 45 PNGViewer* viewer_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(ZoomableMediaImpl); 47 DISALLOW_COPY_AND_ASSIGN(ZoomableMediaImpl);
48 }; 48 };
49 49
50 class NavigatorImpl : public InterfaceImpl<navigation::Navigator> { 50 class NavigatorImpl : public InterfaceImpl<Navigator> {
51 public: 51 public:
52 explicit NavigatorImpl(PNGViewer* viewer) : viewer_(viewer) {} 52 explicit NavigatorImpl(PNGViewer* viewer) : viewer_(viewer) {}
53 virtual ~NavigatorImpl() {} 53 virtual ~NavigatorImpl() {}
54 54
55 private: 55 private:
56 // Overridden from navigation::Navigate: 56 // Overridden from Navigator:
57 virtual void Navigate( 57 virtual void Navigate(
58 uint32_t node_id, 58 uint32_t node_id,
59 navigation::NavigationDetailsPtr navigation_details, 59 NavigationDetailsPtr navigation_details,
60 navigation::ResponseDetailsPtr response_details) OVERRIDE { 60 ResponseDetailsPtr response_details) OVERRIDE {
61 int content_length = GetContentLength(response_details->response->headers); 61 int content_length = GetContentLength(response_details->response->headers);
62 unsigned char* data = new unsigned char[content_length]; 62 unsigned char* data = new unsigned char[content_length];
63 unsigned char* buf = data; 63 unsigned char* buf = data;
64 uint32_t bytes_remaining = content_length; 64 uint32_t bytes_remaining = content_length;
65 uint32_t num_bytes = bytes_remaining; 65 uint32_t num_bytes = bytes_remaining;
66 while (bytes_remaining > 0) { 66 while (bytes_remaining > 0) {
67 MojoResult result = ReadDataRaw( 67 MojoResult result = ReadDataRaw(
68 response_details->response->body.get(), 68 response_details->response->body.get(),
69 buf, 69 buf,
70 &num_bytes, 70 &num_bytes,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 private: 160 private:
161 static const uint16_t kMaxZoomPercentage = 400; 161 static const uint16_t kMaxZoomPercentage = 400;
162 static const uint16_t kMinZoomPercentage = 20; 162 static const uint16_t kMinZoomPercentage = 20;
163 static const uint16_t kDefaultZoomPercentage = 100; 163 static const uint16_t kDefaultZoomPercentage = 100;
164 static const uint16_t kZoomStep = 20; 164 static const uint16_t kZoomStep = 20;
165 165
166 // Overridden from ApplicationDelegate: 166 // Overridden from ApplicationDelegate:
167 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) 167 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
168 MOJO_OVERRIDE { 168 MOJO_OVERRIDE {
169 connection->AddService<navigation::Navigator>(this); 169 connection->AddService<Navigator>(this);
170 connection->AddService<ZoomableMedia>(this); 170 connection->AddService<ZoomableMedia>(this);
171 connection->AddService(&view_manager_client_factory_); 171 connection->AddService(&view_manager_client_factory_);
172 return true; 172 return true;
173 } 173 }
174 174
175 // Overridden from view_manager::ViewManagerDelegate: 175 // Overridden from view_manager::ViewManagerDelegate:
176 virtual void OnRootAdded(view_manager::ViewManager* view_manager, 176 virtual void OnRootAdded(view_manager::ViewManager* view_manager,
177 view_manager::Node* root) OVERRIDE { 177 view_manager::Node* root) OVERRIDE {
178 root_ = root; 178 root_ = root;
179 root_->AddObserver(this); 179 root_->AddObserver(this);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 246
247 } // namespace examples 247 } // namespace examples
248 248
249 // static 249 // static
250 ApplicationDelegate* ApplicationDelegate::Create() { 250 ApplicationDelegate* ApplicationDelegate::Create() {
251 return new examples::PNGViewer; 251 return new examples::PNGViewer;
252 } 252 }
253 253
254 } // namespace mojo 254 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698