diff options
30 files changed, 304 insertions, 348 deletions
diff --git a/mojo/examples/browser/browser.cc b/mojo/examples/browser/browser.cc index dce11ad..719f8f2 100644 --- a/mojo/examples/browser/browser.cc +++ b/mojo/examples/browser/browser.cc @@ -225,11 +225,10 @@ class Browser : public ApplicationDelegate, if (key_event.key_code() == ui::VKEY_RETURN) { GURL url(sender->text()); printf("User entered this URL: %s\n", url.spec().c_str()); - navigation::NavigationDetailsPtr nav_details( - navigation::NavigationDetails::New()); + NavigationDetailsPtr nav_details(NavigationDetails::New()); nav_details->url = String::From(url); navigator_host_->RequestNavigate(view_manager_->GetRoots().front()->id(), - navigation::TARGET_NEW_NODE, + TARGET_NEW_NODE, nav_details.Pass()); } return false; @@ -257,7 +256,7 @@ class Browser : public ApplicationDelegate, ViewManagerClientFactory view_manager_client_factory_; Node* root_; views::Widget* widget_; - navigation::NavigatorHostPtr navigator_host_; + NavigatorHostPtr navigator_host_; IWindowManagerPtr window_manager_; DISALLOW_COPY_AND_ASSIGN(Browser); diff --git a/mojo/examples/embedded_app/embedded_app.cc b/mojo/examples/embedded_app/embedded_app.cc index 9fc72ef..8e0afb6 100644 --- a/mojo/examples/embedded_app/embedded_app.cc +++ b/mojo/examples/embedded_app/embedded_app.cc @@ -27,25 +27,26 @@ namespace mojo { namespace examples { class EmbeddedApp; -class Navigator : public InterfaceImpl<navigation::Navigator> { +class NavigatorImpl : public InterfaceImpl<Navigator> { public: - explicit Navigator(EmbeddedApp* app) : app_(app) {} + explicit NavigatorImpl(EmbeddedApp* app) : app_(app) {} private: virtual void Navigate( uint32 node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) OVERRIDE; + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) OVERRIDE; EmbeddedApp* app_; - DISALLOW_COPY_AND_ASSIGN(Navigator); + DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); }; -class EmbeddedApp : public ApplicationDelegate, - public ViewManagerDelegate, - public ViewObserver, - public NodeObserver, - public InterfaceFactoryWithContext<Navigator, EmbeddedApp> { +class EmbeddedApp + : public ApplicationDelegate, + public ViewManagerDelegate, + public ViewObserver, + public NodeObserver, + public InterfaceFactoryWithContext<NavigatorImpl, EmbeddedApp> { public: EmbeddedApp() : InterfaceFactoryWithContext(this), @@ -95,11 +96,10 @@ class EmbeddedApp : public ApplicationDelegate, virtual void OnViewInputEvent(View* view, const EventPtr& event) OVERRIDE { if (event->action == EVENT_TYPE_MOUSE_RELEASED) { if (event->flags & EVENT_FLAGS_LEFT_MOUSE_BUTTON) { - navigation::NavigationDetailsPtr nav_details( - navigation::NavigationDetails::New()); + NavigationDetailsPtr nav_details(NavigationDetails::New()); nav_details->url = "http://www.aaronboodman.com/z_dropbox/test.html"; navigator_host_->RequestNavigate(view->node()->id(), - navigation::TARGET_SOURCE_NODE, + TARGET_SOURCE_NODE, nav_details.Pass()); } } @@ -134,7 +134,7 @@ class EmbeddedApp : public ApplicationDelegate, } ViewManager* view_manager_; - navigation::NavigatorHostPtr navigator_host_; + NavigatorHostPtr navigator_host_; std::map<Node*, View*> views_to_reap_; ViewManagerClientFactory view_manager_client_factory_; @@ -148,9 +148,9 @@ class EmbeddedApp : public ApplicationDelegate, DISALLOW_COPY_AND_ASSIGN(EmbeddedApp); }; -void Navigator::Navigate(uint32 node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) { +void NavigatorImpl::Navigate(uint32 node_id, + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) { GURL url(navigation_details->url.To<std::string>()); if (!url.is_valid()) { LOG(ERROR) << "URL is invalid."; diff --git a/mojo/examples/media_viewer/media_viewer.cc b/mojo/examples/media_viewer/media_viewer.cc index 3d9281e..706275f 100644 --- a/mojo/examples/media_viewer/media_viewer.cc +++ b/mojo/examples/media_viewer/media_viewer.cc @@ -185,17 +185,17 @@ class ControlPanel : public views::ButtonListener { DISALLOW_COPY_AND_ASSIGN(ControlPanel); }; -class NavigatorImpl : public InterfaceImpl<navigation::Navigator> { +class NavigatorImpl : public InterfaceImpl<Navigator> { public: explicit NavigatorImpl(MediaViewer* viewer) : viewer_(viewer) {} virtual ~NavigatorImpl() {} private: - // Overridden from navigation::Navigate: + // Overridden from Navigator: virtual void Navigate( uint32_t node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) OVERRIDE; + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) OVERRIDE; MediaViewer* viewer_; @@ -228,8 +228,8 @@ class MediaViewer void Navigate( uint32_t node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) { + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) { // TODO(yzshen): This shouldn't be needed once FIFO is ready. if (!view_manager_) { pending_navigate_request_.reset(new PendingNavigateRequest); @@ -248,7 +248,7 @@ class MediaViewer content_node_->Embed(handler); if (navigation_details) { - navigation::NavigatorPtr navigator; + NavigatorPtr navigator; app_->ConnectToService(handler, &navigator); navigator->Navigate(content_node_->id(), navigation_details.Pass(), response_details.Pass()); @@ -264,8 +264,8 @@ class MediaViewer struct PendingNavigateRequest { uint32_t node_id; - navigation::NavigationDetailsPtr navigation_details; - navigation::ResponseDetailsPtr response_details; + NavigationDetailsPtr navigation_details; + ResponseDetailsPtr response_details; }; @@ -374,8 +374,8 @@ class MediaViewer void NavigatorImpl::Navigate( uint32_t node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) { + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) { viewer_->Navigate(node_id, navigation_details.Pass(), response_details.Pass()); } diff --git a/mojo/examples/nesting_app/nesting_app.cc b/mojo/examples/nesting_app/nesting_app.cc index 41c17d0f..3b8c324 100644 --- a/mojo/examples/nesting_app/nesting_app.cc +++ b/mojo/examples/nesting_app/nesting_app.cc @@ -30,27 +30,28 @@ const char kEmbeddedAppURL[] = "mojo:mojo_embedded_app"; class NestingApp; -class Navigator : public InterfaceImpl<navigation::Navigator> { +class NavigatorImpl : public InterfaceImpl<Navigator> { public: - explicit Navigator(NestingApp* app) : app_(app) {} + explicit NavigatorImpl(NestingApp* app) : app_(app) {} private: virtual void Navigate( uint32 node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) OVERRIDE; + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) OVERRIDE; NestingApp* app_; - DISALLOW_COPY_AND_ASSIGN(Navigator); + DISALLOW_COPY_AND_ASSIGN(NavigatorImpl); }; // An app that embeds another app. // TODO(davemoore): Is this the right name? -class NestingApp : public ApplicationDelegate, - public ViewManagerDelegate, - public ViewObserver, - public NodeObserver, - public InterfaceFactoryWithContext<Navigator, NestingApp> { +class NestingApp + : public ApplicationDelegate, + public ViewManagerDelegate, + public ViewObserver, + public NodeObserver, + public InterfaceFactoryWithContext<NavigatorImpl, NestingApp> { public: NestingApp() : InterfaceFactoryWithContext(this), @@ -62,12 +63,10 @@ class NestingApp : public ApplicationDelegate, void NavigateChild() { if (!color_.empty() && nested_) { - navigation::NavigationDetailsPtr details( - navigation::NavigationDetails::New()); + NavigationDetailsPtr details(NavigationDetails::New()); details->url = base::StringPrintf("%s/%s", kEmbeddedAppURL, color_.c_str()); - navigation::ResponseDetailsPtr response_details( - navigation::ResponseDetails::New()); + ResponseDetailsPtr response_details(ResponseDetails::New()); navigator_->Navigate( nested_->id(), details.Pass(), response_details.Pass()); } @@ -122,16 +121,16 @@ class NestingApp : public ApplicationDelegate, std::string color_; Node* nested_; - navigation::NavigatorPtr navigator_; + NavigatorPtr navigator_; IWindowManagerPtr window_manager_; ViewManagerClientFactory view_manager_client_factory_; DISALLOW_COPY_AND_ASSIGN(NestingApp); }; -void Navigator::Navigate(uint32 node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) { +void NavigatorImpl::Navigate(uint32 node_id, + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) { GURL url(navigation_details->url.To<std::string>()); if (!url.is_valid()) { LOG(ERROR) << "URL is invalid."; diff --git a/mojo/examples/png_viewer/png_viewer.cc b/mojo/examples/png_viewer/png_viewer.cc index 3996713..2d16aeb 100644 --- a/mojo/examples/png_viewer/png_viewer.cc +++ b/mojo/examples/png_viewer/png_viewer.cc @@ -47,17 +47,17 @@ class ZoomableMediaImpl : public InterfaceImpl<ZoomableMedia> { DISALLOW_COPY_AND_ASSIGN(ZoomableMediaImpl); }; -class NavigatorImpl : public InterfaceImpl<navigation::Navigator> { +class NavigatorImpl : public InterfaceImpl<Navigator> { public: explicit NavigatorImpl(PNGViewer* viewer) : viewer_(viewer) {} virtual ~NavigatorImpl() {} private: - // Overridden from navigation::Navigate: + // Overridden from Navigator: virtual void Navigate( uint32_t node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) OVERRIDE { + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) OVERRIDE { int content_length = GetContentLength(response_details->response->headers); unsigned char* data = new unsigned char[content_length]; unsigned char* buf = data; @@ -166,7 +166,7 @@ class PNGViewer // Overridden from ApplicationDelegate: virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) MOJO_OVERRIDE { - connection->AddService<navigation::Navigator>(this); + connection->AddService<Navigator>(this); connection->AddService<ZoomableMedia>(this); connection->AddService(&view_manager_client_factory_); return true; diff --git a/mojo/examples/surfaces_app/child.mojom b/mojo/examples/surfaces_app/child.mojom index 926cad8..2fcb00d 100644 --- a/mojo/examples/surfaces_app/child.mojom +++ b/mojo/examples/surfaces_app/child.mojom @@ -7,6 +7,6 @@ import "mojo/services/public/interfaces/surfaces/quads.mojom" import "mojo/services/public/interfaces/surfaces/surface_id.mojom" interface Child { - ProduceFrame(mojo.surfaces.Color color, mojo.Size size) => - (mojo.surfaces.SurfaceId id); + ProduceFrame(mojo.Color color, mojo.Size size) => + (mojo.SurfaceId id); }; diff --git a/mojo/examples/surfaces_app/child_impl.cc b/mojo/examples/surfaces_app/child_impl.cc index e84e933..578c65c 100644 --- a/mojo/examples/surfaces_app/child_impl.cc +++ b/mojo/examples/surfaces_app/child_impl.cc @@ -33,13 +33,13 @@ ChildImpl::ChildImpl(ApplicationConnection* surfaces_service_connection) { } ChildImpl::~ChildImpl() { - surface_->DestroySurface(mojo::surfaces::SurfaceId::From(id_)); + surface_->DestroySurface(mojo::SurfaceId::From(id_)); } void ChildImpl::ProduceFrame( - surfaces::ColorPtr color, + ColorPtr color, SizePtr size, - const mojo::Callback<void(surfaces::SurfaceIdPtr id)>& callback) { + const mojo::Callback<void(SurfaceIdPtr id)>& callback) { color_ = color.To<SkColor>(); size_ = size.To<gfx::Size>(); produce_callback_ = callback; @@ -54,13 +54,13 @@ void ChildImpl::SetIdNamespace(uint32_t id_namespace) { } void ChildImpl::ReturnResources( - Array<surfaces::ReturnedResourcePtr> resources) { + Array<ReturnedResourcePtr> resources) { DCHECK(!resources.size()); } void ChildImpl::Draw() { id_ = allocator_->GenerateId(); - surface_->CreateSurface(mojo::surfaces::SurfaceId::From(id_), + surface_->CreateSurface(mojo::SurfaceId::From(id_), mojo::Size::From(size_)); gfx::Rect rect(size_); RenderPass::Id id(1, 1); @@ -84,9 +84,9 @@ void ChildImpl::Draw() { scoped_ptr<CompositorFrame> frame(new CompositorFrame); frame->delegated_frame_data = delegated_frame_data.Pass(); - surface_->SubmitFrame(mojo::surfaces::SurfaceId::From(id_), - mojo::surfaces::Frame::From(*frame)); - produce_callback_.Run(surfaces::SurfaceId::From(id_)); + surface_->SubmitFrame(mojo::SurfaceId::From(id_), + mojo::Frame::From(*frame)); + produce_callback_.Run(SurfaceId::From(id_)); } } // namespace examples diff --git a/mojo/examples/surfaces_app/child_impl.h b/mojo/examples/surfaces_app/child_impl.h index cdd5263..338b17f 100644 --- a/mojo/examples/surfaces_app/child_impl.h +++ b/mojo/examples/surfaces_app/child_impl.h @@ -30,7 +30,7 @@ class Surface; namespace examples { // Simple example of a child app using surfaces. -class ChildImpl : public InterfaceImpl<Child>, public surfaces::SurfaceClient { +class ChildImpl : public InterfaceImpl<Child>, public SurfaceClient { public: class Context { public: @@ -40,26 +40,26 @@ class ChildImpl : public InterfaceImpl<Child>, public surfaces::SurfaceClient { explicit ChildImpl(ApplicationConnection* surfaces_service_connection); virtual ~ChildImpl(); - // surfaces::SurfaceClient implementation + // SurfaceClient implementation virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE; virtual void ReturnResources( - Array<surfaces::ReturnedResourcePtr> resources) OVERRIDE; + Array<ReturnedResourcePtr> resources) OVERRIDE; private: // Child implementation. virtual void ProduceFrame( - surfaces::ColorPtr color, + ColorPtr color, SizePtr size, - const mojo::Callback<void(surfaces::SurfaceIdPtr id)>& callback) OVERRIDE; + const mojo::Callback<void(SurfaceIdPtr id)>& callback) OVERRIDE; void Draw(); SkColor color_; gfx::Size size_; scoped_ptr<cc::SurfaceIdAllocator> allocator_; - surfaces::SurfacePtr surface_; + SurfacePtr surface_; cc::SurfaceId id_; - mojo::Callback<void(surfaces::SurfaceIdPtr id)> produce_callback_; + mojo::Callback<void(SurfaceIdPtr id)> produce_callback_; DISALLOW_COPY_AND_ASSIGN(ChildImpl); }; diff --git a/mojo/examples/surfaces_app/embedder.cc b/mojo/examples/surfaces_app/embedder.cc index 1a620d0..a23a958 100644 --- a/mojo/examples/surfaces_app/embedder.cc +++ b/mojo/examples/surfaces_app/embedder.cc @@ -26,7 +26,7 @@ using cc::SolidColorDrawQuad; using cc::DelegatedFrameData; using cc::CompositorFrame; -Embedder::Embedder(surfaces::Surface* surface) : surface_(surface) { +Embedder::Embedder(Surface* surface) : surface_(surface) { } Embedder::~Embedder() { @@ -84,8 +84,8 @@ void Embedder::ProduceFrame(cc::SurfaceId child_one, scoped_ptr<CompositorFrame> frame(new CompositorFrame); frame->delegated_frame_data = delegated_frame_data.Pass(); - surface_->SubmitFrame(mojo::surfaces::SurfaceId::From(id_), - mojo::surfaces::Frame::From(*frame)); + surface_->SubmitFrame(mojo::SurfaceId::From(id_), + mojo::Frame::From(*frame)); } } // namespace examples diff --git a/mojo/examples/surfaces_app/embedder.h b/mojo/examples/surfaces_app/embedder.h index 4e04dfd..56212f3 100644 --- a/mojo/examples/surfaces_app/embedder.h +++ b/mojo/examples/surfaces_app/embedder.h @@ -23,7 +23,7 @@ namespace examples { // Simple example of a surface embedder that embeds two other surfaces. class Embedder { public: - explicit Embedder(surfaces::Surface* surface); + explicit Embedder(Surface* surface); ~Embedder(); void SetSurfaceId(cc::SurfaceId id) { id_ = id; } @@ -35,7 +35,7 @@ class Embedder { private: cc::SurfaceId id_; - surfaces::Surface* surface_; + Surface* surface_; DISALLOW_COPY_AND_ASSIGN(Embedder); }; diff --git a/mojo/examples/surfaces_app/surfaces_app.cc b/mojo/examples/surfaces_app/surfaces_app.cc index ca5e36f..30c0ec02 100644 --- a/mojo/examples/surfaces_app/surfaces_app.cc +++ b/mojo/examples/surfaces_app/surfaces_app.cc @@ -22,7 +22,7 @@ namespace mojo { namespace examples { class SurfacesApp : public ApplicationDelegate, - public surfaces::SurfaceClient, + public SurfaceClient, public NativeViewportClient { public: SurfacesApp() {} @@ -46,11 +46,11 @@ class SurfacesApp : public ApplicationDelegate, child_size_ = gfx::Size(size_.width() / 3, size_.height() / 2); connection->ConnectToService("mojo:mojo_surfaces_child_app", &child_one_); connection->ConnectToService("mojo:mojo_surfaces_child_app", &child_two_); - child_one_->ProduceFrame(surfaces::Color::From(SK_ColorBLUE), + child_one_->ProduceFrame(Color::From(SK_ColorBLUE), Size::From(child_size_), base::Bind(&SurfacesApp::ChildOneProducedFrame, base::Unretained(this))); - child_two_->ProduceFrame(surfaces::Color::From(SK_ColorGREEN), + child_two_->ProduceFrame(Color::From(SK_ColorGREEN), Size::From(child_size_), base::Bind(&SurfacesApp::ChildTwoProducedFrame, base::Unretained(this))); @@ -58,12 +58,12 @@ class SurfacesApp : public ApplicationDelegate, return true; } - void ChildOneProducedFrame(surfaces::SurfaceIdPtr id) { + void ChildOneProducedFrame(SurfaceIdPtr id) { child_one_id_ = id.To<cc::SurfaceId>(); Draw(45.0); } - void ChildTwoProducedFrame(surfaces::SurfaceIdPtr id) { + void ChildTwoProducedFrame(SurfaceIdPtr id) { child_two_id_ = id.To<cc::SurfaceId>(); Draw(45.0); } @@ -75,7 +75,7 @@ class SurfacesApp : public ApplicationDelegate, viewport_->CreateGLES2Context(Get(&cb)); surfaces_->CreateGLES2BoundSurface( cb.Pass(), - surfaces::SurfaceId::From(onscreen_id_), + SurfaceId::From(onscreen_id_), Size::From(size_)); embedder_->SetSurfaceId(onscreen_id_); } @@ -90,13 +90,13 @@ class SurfacesApp : public ApplicationDelegate, base::TimeDelta::FromMilliseconds(17)); } - // surfaces::SurfaceClient implementation. + // SurfaceClient implementation. virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE { allocator_.reset(new cc::SurfaceIdAllocator(id_namespace)); Draw(45.0); } virtual void ReturnResources( - Array<surfaces::ReturnedResourcePtr> resources) OVERRIDE { + Array<ReturnedResourcePtr> resources) OVERRIDE { DCHECK(!resources.size()); } @@ -112,7 +112,7 @@ class SurfacesApp : public ApplicationDelegate, } private: - surfaces::SurfacePtr surfaces_; + SurfacePtr surfaces_; cc::SurfaceId onscreen_id_; scoped_ptr<cc::SurfaceIdAllocator> allocator_; scoped_ptr<Embedder> embedder_; diff --git a/mojo/examples/window_manager/debug_panel.cc b/mojo/examples/window_manager/debug_panel.cc index dfd2b2a..915556d 100644 --- a/mojo/examples/window_manager/debug_panel.cc +++ b/mojo/examples/window_manager/debug_panel.cc @@ -74,12 +74,12 @@ gfx::Size DebugPanel::GetPreferredSize(const views::View* view) const { return gfx::Size(); } -navigation::Target DebugPanel::navigation_target() const { +Target DebugPanel::navigation_target() const { if (navigation_target_new_->checked()) - return navigation::TARGET_NEW_NODE; + return TARGET_NEW_NODE; if (navigation_target_source_->checked()) - return navigation::TARGET_SOURCE_NODE; - return navigation::TARGET_DEFAULT; + return TARGET_SOURCE_NODE; + return TARGET_DEFAULT; } void DebugPanel::Layout(views::View* view) { @@ -128,11 +128,9 @@ void DebugPanel::ButtonPressed(views::Button* sender, const ui::Event& event) { } void DebugPanel::Navigate(const std::string& url) { - navigation::NavigationDetailsPtr details( - navigation::NavigationDetails::New()); + NavigationDetailsPtr details(NavigationDetails::New()); details->url = url; - delegate_->RequestNavigate( - node_->id(), navigation::TARGET_NEW_NODE, details.Pass()); + delegate_->RequestNavigate(node_->id(), TARGET_NEW_NODE, details.Pass()); } } // namespace examples diff --git a/mojo/examples/window_manager/debug_panel.h b/mojo/examples/window_manager/debug_panel.h index 5e6619b..181de76 100644 --- a/mojo/examples/window_manager/debug_panel.h +++ b/mojo/examples/window_manager/debug_panel.h @@ -39,8 +39,8 @@ class DebugPanel : public views::LayoutManager, public views::ButtonListener { public: virtual void CloseTopWindow() = 0; virtual void RequestNavigate( - uint32 source_node_id, navigation::Target target, - navigation::NavigationDetailsPtr nav_details) = 0; + uint32 source_node_id, Target target, + NavigationDetailsPtr nav_details) = 0; protected: virtual ~Delegate(){} }; @@ -48,7 +48,7 @@ class DebugPanel : public views::LayoutManager, public views::ButtonListener { DebugPanel(Delegate* delegate, Node* node); virtual ~DebugPanel(); - navigation::Target navigation_target() const; + Target navigation_target() const; private: // LayoutManager overrides: diff --git a/mojo/examples/window_manager/window_manager.cc b/mojo/examples/window_manager/window_manager.cc index 74c0245..e89f2b8 100644 --- a/mojo/examples/window_manager/window_manager.cc +++ b/mojo/examples/window_manager/window_manager.cc @@ -62,11 +62,11 @@ class WindowManagerConnection : public InterfaceImpl<IWindowManager> { DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); }; -class NavigatorHost : public InterfaceImpl<navigation::NavigatorHost> { +class NavigatorHostImpl : public InterfaceImpl<NavigatorHost> { public: - explicit NavigatorHost(WindowManager* window_manager) + explicit NavigatorHostImpl(WindowManager* window_manager) : window_manager_(window_manager) {} - virtual ~NavigatorHost() { + virtual ~NavigatorHostImpl() { } private: @@ -74,11 +74,11 @@ class NavigatorHost : public InterfaceImpl<navigation::NavigatorHost> { const mojo::String& url) OVERRIDE; virtual void RequestNavigate( uint32 source_node_id, - navigation::Target target, - navigation::NavigationDetailsPtr nav_details) OVERRIDE; + Target target, + NavigationDetailsPtr nav_details) OVERRIDE; WindowManager* window_manager_; - DISALLOW_COPY_AND_ASSIGN(NavigatorHost); + DISALLOW_COPY_AND_ASSIGN(NavigatorHostImpl); }; class KeyboardManager : public KeyboardClient, @@ -254,12 +254,12 @@ class WindowManager public WindowManagerDelegate, public InterfaceFactoryWithContext<WindowManagerConnection, WindowManager>, - public InterfaceFactoryWithContext<NavigatorHost, WindowManager> { + public InterfaceFactoryWithContext<NavigatorHostImpl, WindowManager> { public: WindowManager() : InterfaceFactoryWithContext<WindowManagerConnection, WindowManager>( this), - InterfaceFactoryWithContext<NavigatorHost, WindowManager>(this), + InterfaceFactoryWithContext<NavigatorHostImpl, WindowManager>(this), launcher_ui_(NULL), view_manager_(NULL), view_manager_client_factory_(this), @@ -315,8 +315,8 @@ class WindowManager virtual void RequestNavigate( uint32 source_node_id, - navigation::Target target, - navigation::NavigationDetailsPtr nav_details) OVERRIDE { + Target target, + NavigationDetailsPtr nav_details) OVERRIDE { launcher_->Launch(nav_details->url, base::Bind(&WindowManager::OnLaunch, base::Unretained(this), @@ -335,7 +335,7 @@ class WindowManager virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) MOJO_OVERRIDE { connection->AddService<IWindowManager>(this); - connection->AddService<navigation::NavigatorHost>(this); + connection->AddService<mojo::NavigatorHost>(this); connection->AddService(&view_manager_client_factory_); return true; } @@ -374,8 +374,8 @@ class WindowManager // Overridden from WindowManagerDelegate: virtual void Embed(const String& url) OVERRIDE { CreateWindow(url, - navigation::NavigationDetailsPtr().Pass(), - navigation::ResponseDetailsPtr().Pass()); + NavigationDetailsPtr().Pass(), + ResponseDetailsPtr().Pass()); } virtual void DispatchEvent(View* target, EventPtr event) OVERRIDE { // TODO(beng): More sophisticated focus handling than this is required! @@ -388,27 +388,26 @@ class WindowManager void OnLaunch( uint32 source_node_id, - navigation::Target requested_target, + Target requested_target, const mojo::String& handler_url, const mojo::String& view_url, - navigation::ResponseDetailsPtr response) { - navigation::NavigationDetailsPtr nav_details( - navigation::NavigationDetails::New()); + ResponseDetailsPtr response) { + NavigationDetailsPtr nav_details(NavigationDetails::New()); nav_details->url = view_url; - navigation::Target target = debug_panel_->navigation_target(); - if (target == navigation::TARGET_DEFAULT) { - if (requested_target != navigation::TARGET_DEFAULT) { + Target target = debug_panel_->navigation_target(); + if (target == TARGET_DEFAULT) { + if (requested_target != TARGET_DEFAULT) { target = requested_target; } else { // TODO(aa): Should be TARGET_NEW_NODE if source origin and dest origin // are different? - target = navigation::TARGET_SOURCE_NODE; + target = TARGET_SOURCE_NODE; } } Node* dest_node = NULL; - if (target == navigation::TARGET_SOURCE_NODE) { + if (target == TARGET_SOURCE_NODE) { Node* source_node = view_manager_->GetNodeById(source_node_id); bool app_initiated = std::find(windows_.begin(), windows_.end(), source_node) != windows_.end(); @@ -426,8 +425,8 @@ class WindowManager // TODO(beng): proper layout manager!! Id CreateLauncherUI() { - navigation::NavigationDetailsPtr nav_details; - navigation::ResponseDetailsPtr response; + NavigationDetailsPtr nav_details; + ResponseDetailsPtr response; Node* node = view_manager_->GetNodeById(content_node_id_); gfx::Rect bounds = node->bounds(); bounds.Inset(kBorderInset, kBorderInset); @@ -438,8 +437,8 @@ class WindowManager } void CreateWindow(const std::string& handler_url, - navigation::NavigationDetailsPtr nav_details, - navigation::ResponseDetailsPtr response) { + NavigationDetailsPtr nav_details, + ResponseDetailsPtr response) { Node* node = view_manager_->GetNodeById(content_node_id_); gfx::Rect bounds(kBorderInset, 2 * kBorderInset + kTextfieldHeight, @@ -459,8 +458,8 @@ class WindowManager Node* CreateChild(Id parent_id, const std::string& url, const gfx::Rect& bounds, - navigation::NavigationDetailsPtr nav_details, - navigation::ResponseDetailsPtr response) { + NavigationDetailsPtr nav_details, + ResponseDetailsPtr response) { Node* node = view_manager_->GetNodeById(parent_id); Node* embedded = Node::Create(view_manager_); node->AddChild(embedded); @@ -471,11 +470,11 @@ class WindowManager } void Embed(Node* node, const std::string& app_url, - navigation::NavigationDetailsPtr nav_details, - navigation::ResponseDetailsPtr response) { + NavigationDetailsPtr nav_details, + ResponseDetailsPtr response) { node->Embed(app_url); if (nav_details) { - navigation::NavigatorPtr navigator; + NavigatorPtr navigator; app_->ConnectToService(app_url, &navigator); navigator->Navigate(node->id(), nav_details.Pass(), response.Pass()); } @@ -506,7 +505,7 @@ class WindowManager scoped_ptr<ViewsInit> views_init_; DebugPanel* debug_panel_; - launcher::LauncherPtr launcher_; + LauncherPtr launcher_; Node* launcher_ui_; std::vector<Node*> windows_; ViewManager* view_manager_; @@ -534,15 +533,15 @@ void WindowManagerConnection::HideKeyboard(Id node_id) { window_manager_->HideKeyboard(node_id); } -void NavigatorHost::DidNavigateLocally(uint32 source_node_id, - const mojo::String& url) { +void NavigatorHostImpl::DidNavigateLocally(uint32 source_node_id, + const mojo::String& url) { window_manager_->DidNavigateLocally(source_node_id, url); } -void NavigatorHost::RequestNavigate( +void NavigatorHostImpl::RequestNavigate( uint32 source_node_id, - navigation::Target target, - navigation::NavigationDetailsPtr nav_details) { + Target target, + NavigationDetailsPtr nav_details) { window_manager_->RequestNavigate(source_node_id, target, nav_details.Pass()); } diff --git a/mojo/services/html_viewer/html_document_view.cc b/mojo/services/html_viewer/html_document_view.cc index f133ad0..8c549a7 100644 --- a/mojo/services/html_viewer/html_document_view.cc +++ b/mojo/services/html_viewer/html_document_view.cc @@ -40,18 +40,18 @@ void ConfigureSettings(blink::WebSettings* settings) { settings->setJavaScriptEnabled(true); } -navigation::Target WebNavigationPolicyToNavigationTarget( +Target WebNavigationPolicyToNavigationTarget( blink::WebNavigationPolicy policy) { switch (policy) { case blink::WebNavigationPolicyCurrentTab: - return navigation::TARGET_SOURCE_NODE; + return TARGET_SOURCE_NODE; case blink::WebNavigationPolicyNewBackgroundTab: case blink::WebNavigationPolicyNewForegroundTab: case blink::WebNavigationPolicyNewWindow: case blink::WebNavigationPolicyNewPopup: - return navigation::TARGET_NEW_NODE; + return TARGET_NEW_NODE; default: - return navigation::TARGET_DEFAULT; + return TARGET_DEFAULT; } } @@ -160,8 +160,7 @@ blink::WebNavigationPolicy HTMLDocumentView::decidePolicyForNavigation( if (CanNavigateLocally(frame, request)) return default_policy; - navigation::NavigationDetailsPtr nav_details( - navigation::NavigationDetails::New()); + NavigationDetailsPtr nav_details(NavigationDetails::New()); nav_details->url = request.url().string().utf8(); navigator_host_->RequestNavigate( view_->node()->id(), diff --git a/mojo/services/html_viewer/html_document_view.h b/mojo/services/html_viewer/html_document_view.h index 41b3c65..8c816b9 100644 --- a/mojo/services/html_viewer/html_document_view.h +++ b/mojo/services/html_viewer/html_document_view.h @@ -76,7 +76,7 @@ class HTMLDocumentView : public blink::WebViewClient, blink::WebView* web_view_; Node* root_; bool repaint_pending_; - LazyInterfacePtr<navigation::NavigatorHost> navigator_host_; + LazyInterfacePtr<NavigatorHost> navigator_host_; base::WeakPtrFactory<HTMLDocumentView> weak_factory_; DISALLOW_COPY_AND_ASSIGN(HTMLDocumentView); diff --git a/mojo/services/html_viewer/html_viewer.cc b/mojo/services/html_viewer/html_viewer.cc index 9014087..005f73c 100644 --- a/mojo/services/html_viewer/html_viewer.cc +++ b/mojo/services/html_viewer/html_viewer.cc @@ -22,17 +22,17 @@ namespace mojo { class HTMLViewer; -class NavigatorImpl : public InterfaceImpl<navigation::Navigator> { +class NavigatorImpl : public InterfaceImpl<Navigator> { public: explicit NavigatorImpl(HTMLViewer* viewer) : viewer_(viewer) {} virtual ~NavigatorImpl() {} private: - // Overridden from navigation::Navigator: + // Overridden from Navigator: virtual void Navigate( uint32_t node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) OVERRIDE; + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) OVERRIDE; HTMLViewer* viewer_; @@ -105,8 +105,8 @@ class HTMLViewer void NavigatorImpl::Navigate( uint32_t node_id, - navigation::NavigationDetailsPtr navigation_details, - navigation::ResponseDetailsPtr response_details) { + NavigationDetailsPtr navigation_details, + ResponseDetailsPtr response_details) { viewer_->Load(response_details->response.Pass()); } diff --git a/mojo/services/launcher/launcher.cc b/mojo/services/launcher/launcher.cc index 374d912..29cec80 100644 --- a/mojo/services/launcher/launcher.cc +++ b/mojo/services/launcher/launcher.cc @@ -18,12 +18,11 @@ #include "url/gurl.h" namespace mojo { -namespace launcher { namespace { typedef mojo::Callback<void(String handler_url, String view_url, - navigation::ResponseDetailsPtr response)> LaunchCallback; + ResponseDetailsPtr response)> LaunchCallback; } @@ -135,8 +134,7 @@ void LauncherConnection::Launch(const String& url_string, // For Mojo URLs, the handler can always be found at the origin. // TODO(aa): Return error for invalid URL? if (url.is_valid() && url.SchemeIs("mojo")) { - callback.Run(url.GetOrigin().spec(), url_string, - navigation::ResponseDetailsPtr()); + callback.Run(url.GetOrigin().spec(), url_string, ResponseDetailsPtr()); return; } new LaunchInstance(app_, callback, url_string); @@ -166,8 +164,7 @@ void LaunchInstance::OnReceivedResponse(URLResponsePtr response) { if (handler_url.empty()) { DLOG(WARNING) << "No handler for content type: " << content_type; } else { - navigation::ResponseDetailsPtr nav_response( - navigation::ResponseDetails::New()); + ResponseDetailsPtr nav_response(ResponseDetails::New()); nav_response->loader = url_loader_.Pass(); nav_response->response = response.Pass(); String response_url = nav_response->response->url; @@ -177,11 +174,9 @@ void LaunchInstance::OnReceivedResponse(URLResponsePtr response) { ScheduleDestroy(); } -} // namespace launcher - // static ApplicationDelegate* ApplicationDelegate::Create() { - return new launcher::LauncherApp; + return new LauncherApp; } } // namespace mojo diff --git a/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc b/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc index b30f999..309d1a1 100644 --- a/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc +++ b/mojo/services/public/cpp/surfaces/lib/surfaces_type_converters.cc @@ -19,7 +19,7 @@ namespace mojo { #define ASSERT_ENUM_VALUES_EQUAL(value) \ COMPILE_ASSERT(cc::DrawQuad::value == static_cast<cc::DrawQuad::Material>( \ - surfaces::MATERIAL_##value), \ + MATERIAL_##value), \ value##_enum_value_matches) ASSERT_ENUM_VALUES_EQUAL(CHECKERBOARD); @@ -37,7 +37,7 @@ ASSERT_ENUM_VALUES_EQUAL(YUV_VIDEO_CONTENT); namespace { cc::SharedQuadState* ConvertToSharedQuadState( - const surfaces::SharedQuadStatePtr& input, + const SharedQuadStatePtr& input, cc::RenderPass* render_pass) { cc::SharedQuadState* state = render_pass->CreateAndAppendSharedQuadState(); state->SetAll(input->content_to_target_transform.To<gfx::Transform>(), @@ -46,16 +46,16 @@ cc::SharedQuadState* ConvertToSharedQuadState( input->clip_rect.To<gfx::Rect>(), input->is_clipped, input->opacity, - static_cast<SkXfermode::Mode>(input->blend_mode), + static_cast<::SkXfermode::Mode>(input->blend_mode), input->sorting_context_id); return state; } -bool ConvertToDrawQuad(const surfaces::QuadPtr& input, +bool ConvertToDrawQuad(const QuadPtr& input, cc::SharedQuadState* sqs, cc::RenderPass* render_pass) { switch (input->material) { - case surfaces::MATERIAL_SOLID_COLOR: { + case MATERIAL_SOLID_COLOR: { if (input->solid_color_quad_state.is_null()) return false; cc::SolidColorDrawQuad* color_quad = @@ -70,7 +70,7 @@ bool ConvertToDrawQuad(const surfaces::QuadPtr& input, input->solid_color_quad_state->force_anti_aliasing_off); break; } - case surfaces::MATERIAL_SURFACE_CONTENT: { + case MATERIAL_SURFACE_CONTENT: { if (input->surface_quad_state.is_null()) return false; cc::SurfaceDrawQuad* surface_quad = @@ -84,8 +84,8 @@ bool ConvertToDrawQuad(const surfaces::QuadPtr& input, input->surface_quad_state->surface.To<cc::SurfaceId>()); break; } - case surfaces::MATERIAL_TEXTURE_CONTENT: { - surfaces::TextureQuadStatePtr& texture_quad_state = + case MATERIAL_TEXTURE_CONTENT: { + TextureQuadStatePtr& texture_quad_state = input->texture_quad_state; if (texture_quad_state.is_null() || texture_quad_state->vertex_opacity.is_null() || @@ -118,39 +118,39 @@ bool ConvertToDrawQuad(const surfaces::QuadPtr& input, } // namespace // static -surfaces::SurfaceIdPtr -TypeConverter<surfaces::SurfaceIdPtr, cc::SurfaceId>::ConvertFrom( +SurfaceIdPtr +TypeConverter<SurfaceIdPtr, cc::SurfaceId>::ConvertFrom( const cc::SurfaceId& input) { - surfaces::SurfaceIdPtr id(surfaces::SurfaceId::New()); + SurfaceIdPtr id(SurfaceId::New()); id->id = input.id; return id.Pass(); } // static -cc::SurfaceId TypeConverter<surfaces::SurfaceIdPtr, cc::SurfaceId>::ConvertTo( - const surfaces::SurfaceIdPtr& input) { +cc::SurfaceId TypeConverter<SurfaceIdPtr, cc::SurfaceId>::ConvertTo( + const SurfaceIdPtr& input) { return cc::SurfaceId(input->id); } // static -surfaces::ColorPtr TypeConverter<surfaces::ColorPtr, SkColor>::ConvertFrom( +ColorPtr TypeConverter<ColorPtr, SkColor>::ConvertFrom( const SkColor& input) { - surfaces::ColorPtr color(surfaces::Color::New()); + ColorPtr color(Color::New()); color->rgba = input; return color.Pass(); } // static -SkColor TypeConverter<surfaces::ColorPtr, SkColor>::ConvertTo( - const surfaces::ColorPtr& input) { +SkColor TypeConverter<ColorPtr, SkColor>::ConvertTo( + const ColorPtr& input) { return input->rgba; } // static -surfaces::QuadPtr TypeConverter<surfaces::QuadPtr, cc::DrawQuad>::ConvertFrom( +QuadPtr TypeConverter<QuadPtr, cc::DrawQuad>::ConvertFrom( const cc::DrawQuad& input) { - surfaces::QuadPtr quad = surfaces::Quad::New(); - quad->material = static_cast<surfaces::Material>(input.material); + QuadPtr quad = Quad::New(); + quad->material = static_cast<Material>(input.material); quad->rect = Rect::From(input.rect); quad->opaque_rect = Rect::From(input.opaque_rect); quad->visible_rect = Rect::From(input.visible_rect); @@ -163,9 +163,8 @@ surfaces::QuadPtr TypeConverter<surfaces::QuadPtr, cc::DrawQuad>::ConvertFrom( case cc::DrawQuad::SOLID_COLOR: { const cc::SolidColorDrawQuad* color_quad = cc::SolidColorDrawQuad::MaterialCast(&input); - surfaces::SolidColorQuadStatePtr color_state = - surfaces::SolidColorQuadState::New(); - color_state->color = surfaces::Color::From(color_quad->color); + SolidColorQuadStatePtr color_state = SolidColorQuadState::New(); + color_state->color = Color::From(color_quad->color); color_state->force_anti_aliasing_off = color_quad->force_anti_aliasing_off; quad->solid_color_quad_state = color_state.Pass(); @@ -174,26 +173,24 @@ surfaces::QuadPtr TypeConverter<surfaces::QuadPtr, cc::DrawQuad>::ConvertFrom( case cc::DrawQuad::SURFACE_CONTENT: { const cc::SurfaceDrawQuad* surface_quad = cc::SurfaceDrawQuad::MaterialCast(&input); - surfaces::SurfaceQuadStatePtr surface_state = - surfaces::SurfaceQuadState::New(); - surface_state->surface = - surfaces::SurfaceId::From(surface_quad->surface_id); + SurfaceQuadStatePtr surface_state = + SurfaceQuadState::New(); + surface_state->surface = SurfaceId::From(surface_quad->surface_id); quad->surface_quad_state = surface_state.Pass(); break; } case cc::DrawQuad::TEXTURE_CONTENT: { const cc::TextureDrawQuad* texture_quad = cc::TextureDrawQuad::MaterialCast(&input); - surfaces::TextureQuadStatePtr texture_state = - surfaces::TextureQuadState::New(); - texture_state = surfaces::TextureQuadState::New(); + TextureQuadStatePtr texture_state = TextureQuadState::New(); + texture_state = TextureQuadState::New(); texture_state->resource_id = texture_quad->resource_id; texture_state->premultiplied_alpha = texture_quad->premultiplied_alpha; texture_state->uv_top_left = PointF::From(texture_quad->uv_top_left); texture_state->uv_bottom_right = PointF::From(texture_quad->uv_bottom_right); texture_state->background_color = - surfaces::Color::From(texture_quad->background_color); + Color::From(texture_quad->background_color); Array<float> vertex_opacity(4); for (size_t i = 0; i < 4; ++i) { vertex_opacity[i] = texture_quad->vertex_opacity[i]; @@ -210,10 +207,10 @@ surfaces::QuadPtr TypeConverter<surfaces::QuadPtr, cc::DrawQuad>::ConvertFrom( } // static -surfaces::SharedQuadStatePtr -TypeConverter<surfaces::SharedQuadStatePtr, cc::SharedQuadState>::ConvertFrom( +SharedQuadStatePtr +TypeConverter<SharedQuadStatePtr, cc::SharedQuadState>::ConvertFrom( const cc::SharedQuadState& input) { - surfaces::SharedQuadStatePtr state = surfaces::SharedQuadState::New(); + SharedQuadStatePtr state = SharedQuadState::New(); state->content_to_target_transform = Transform::From(input.content_to_target_transform); state->content_bounds = Size::From(input.content_bounds); @@ -221,33 +218,33 @@ TypeConverter<surfaces::SharedQuadStatePtr, cc::SharedQuadState>::ConvertFrom( state->clip_rect = Rect::From(input.clip_rect); state->is_clipped = input.is_clipped; state->opacity = input.opacity; - state->blend_mode = static_cast<surfaces::SkXfermode>(input.blend_mode); + state->blend_mode = static_cast<SkXfermode>(input.blend_mode); state->sorting_context_id = input.sorting_context_id; return state.Pass(); } // static -surfaces::PassPtr TypeConverter<surfaces::PassPtr, cc::RenderPass>::ConvertFrom( +PassPtr TypeConverter<PassPtr, cc::RenderPass>::ConvertFrom( const cc::RenderPass& input) { - surfaces::PassPtr pass = surfaces::Pass::New(); + PassPtr pass = Pass::New(); pass->id = input.id.index; pass->output_rect = Rect::From(input.output_rect); pass->damage_rect = Rect::From(input.damage_rect); pass->transform_to_root_target = Transform::From(input.transform_to_root_target); pass->has_transparent_background = input.has_transparent_background; - Array<surfaces::QuadPtr> quads(input.quad_list.size()); - Array<surfaces::SharedQuadStatePtr> shared_quad_state( + Array<QuadPtr> quads(input.quad_list.size()); + Array<SharedQuadStatePtr> shared_quad_state( input.shared_quad_state_list.size()); int sqs_i = -1; const cc::SharedQuadState* last_sqs = NULL; for (size_t i = 0; i < quads.size(); ++i) { const cc::DrawQuad& quad = *input.quad_list[i]; - quads[i] = surfaces::Quad::From(quad); + quads[i] = Quad::From(quad); if (quad.shared_quad_state != last_sqs) { sqs_i++; shared_quad_state[sqs_i] = - surfaces::SharedQuadState::From(*input.shared_quad_state_list[i]); + SharedQuadState::From(*input.shared_quad_state_list[i]); last_sqs = quad.shared_quad_state; } quads[i]->shared_quad_state_index = sqs_i; @@ -260,7 +257,7 @@ surfaces::PassPtr TypeConverter<surfaces::PassPtr, cc::RenderPass>::ConvertFrom( } // static -scoped_ptr<cc::RenderPass> ConvertTo(const surfaces::PassPtr& input) { +scoped_ptr<cc::RenderPass> ConvertTo(const PassPtr& input) { scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); pass->SetAll(cc::RenderPass::Id(1, input->id), input->output_rect.To<gfx::Rect>(), @@ -274,7 +271,7 @@ scoped_ptr<cc::RenderPass> ConvertTo(const surfaces::PassPtr& input) { } pass->quad_list.reserve(input->quads.size()); for (size_t i = 0; i < input->quads.size(); ++i) { - surfaces::QuadPtr quad = input->quads[i].Pass(); + QuadPtr quad = input->quads[i].Pass(); if (!ConvertToDrawQuad( quad, sqs_list[quad->shared_quad_state_index], pass.get())) return scoped_ptr<cc::RenderPass>(); @@ -283,21 +280,20 @@ scoped_ptr<cc::RenderPass> ConvertTo(const surfaces::PassPtr& input) { } // static -surfaces::MailboxPtr -TypeConverter<surfaces::MailboxPtr, gpu::Mailbox>::ConvertFrom( +MailboxPtr TypeConverter<MailboxPtr, gpu::Mailbox>::ConvertFrom( const gpu::Mailbox& input) { Array<int8_t> name(64); for (int i = 0; i < 64; ++i) { name[i] = input.name[i]; } - surfaces::MailboxPtr mailbox(surfaces::Mailbox::New()); + MailboxPtr mailbox(Mailbox::New()); mailbox->name = name.Pass(); return mailbox.Pass(); } // static -gpu::Mailbox TypeConverter<surfaces::MailboxPtr, gpu::Mailbox>::ConvertTo( - const surfaces::MailboxPtr& input) { +gpu::Mailbox TypeConverter<MailboxPtr, gpu::Mailbox>::ConvertTo( + const MailboxPtr& input) { gpu::Mailbox mailbox; if (!input->name.is_null()) mailbox.SetName(&input->name.storage()[0]); @@ -305,11 +301,11 @@ gpu::Mailbox TypeConverter<surfaces::MailboxPtr, gpu::Mailbox>::ConvertTo( } // static -surfaces::MailboxHolderPtr -TypeConverter<surfaces::MailboxHolderPtr, gpu::MailboxHolder>::ConvertFrom( +MailboxHolderPtr +TypeConverter<MailboxHolderPtr, gpu::MailboxHolder>::ConvertFrom( const gpu::MailboxHolder& input) { - surfaces::MailboxHolderPtr holder(surfaces::MailboxHolder::New()); - holder->mailbox = surfaces::Mailbox::From<gpu::Mailbox>(input.mailbox); + MailboxHolderPtr holder(MailboxHolder::New()); + holder->mailbox = Mailbox::From<gpu::Mailbox>(input.mailbox); holder->texture_target = input.texture_target; holder->sync_point = input.sync_point; return holder.Pass(); @@ -317,8 +313,8 @@ TypeConverter<surfaces::MailboxHolderPtr, gpu::MailboxHolder>::ConvertFrom( // static gpu::MailboxHolder -TypeConverter<surfaces::MailboxHolderPtr, gpu::MailboxHolder>::ConvertTo( - const surfaces::MailboxHolderPtr& input) { +TypeConverter<MailboxHolderPtr, gpu::MailboxHolder>::ConvertTo( + const MailboxHolderPtr& input) { gpu::MailboxHolder holder; holder.mailbox = input->mailbox.To<gpu::Mailbox>(); holder.texture_target = input->texture_target; @@ -327,18 +323,16 @@ TypeConverter<surfaces::MailboxHolderPtr, gpu::MailboxHolder>::ConvertTo( } // static -surfaces::TransferableResourcePtr TypeConverter< - surfaces::TransferableResourcePtr, +TransferableResourcePtr TypeConverter< + TransferableResourcePtr, cc::TransferableResource>::ConvertFrom(const cc::TransferableResource& input) { - surfaces::TransferableResourcePtr transferable = - surfaces::TransferableResource::New(); + TransferableResourcePtr transferable = TransferableResource::New(); transferable->id = input.id; - transferable->format = static_cast<surfaces::ResourceFormat>(input.format); + transferable->format = static_cast<ResourceFormat>(input.format); transferable->filter = input.filter; transferable->size = Size::From(input.size); - transferable->mailbox_holder = - surfaces::MailboxHolder::From(input.mailbox_holder); + transferable->mailbox_holder = MailboxHolder::From(input.mailbox_holder); transferable->is_repeated = input.is_repeated; transferable->is_software = input.is_software; return transferable.Pass(); @@ -346,8 +340,8 @@ surfaces::TransferableResourcePtr TypeConverter< // static cc::TransferableResource -TypeConverter<surfaces::TransferableResourcePtr, cc::TransferableResource>:: - ConvertTo(const surfaces::TransferableResourcePtr& input) { +TypeConverter<TransferableResourcePtr, cc::TransferableResource>:: + ConvertTo(const TransferableResourcePtr& input) { cc::TransferableResource transferable; transferable.id = input->id; transferable.format = static_cast<cc::ResourceFormat>(input->format); @@ -360,22 +354,22 @@ TypeConverter<surfaces::TransferableResourcePtr, cc::TransferableResource>:: } // static -Array<surfaces::TransferableResourcePtr> -TypeConverter<Array<surfaces::TransferableResourcePtr>, +Array<TransferableResourcePtr> +TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray>:: ConvertFrom(const cc::TransferableResourceArray& input) { - Array<surfaces::TransferableResourcePtr> resources(input.size()); + Array<TransferableResourcePtr> resources(input.size()); for (size_t i = 0; i < input.size(); ++i) { - resources[i] = surfaces::TransferableResource::From(input[i]); + resources[i] = TransferableResource::From(input[i]); } return resources.Pass(); } // static cc::TransferableResourceArray -TypeConverter<Array<surfaces::TransferableResourcePtr>, +TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray>:: - ConvertTo(const Array<surfaces::TransferableResourcePtr>& input) { + ConvertTo(const Array<TransferableResourcePtr>& input) { cc::TransferableResourceArray resources(input.size()); for (size_t i = 0; i < input.size(); ++i) { resources[i] = input[i].To<cc::TransferableResource>(); @@ -384,10 +378,10 @@ TypeConverter<Array<surfaces::TransferableResourcePtr>, } // static -surfaces::ReturnedResourcePtr -TypeConverter<surfaces::ReturnedResourcePtr, cc::ReturnedResource>::ConvertFrom( +ReturnedResourcePtr +TypeConverter<ReturnedResourcePtr, cc::ReturnedResource>::ConvertFrom( const cc::ReturnedResource& input) { - surfaces::ReturnedResourcePtr returned = surfaces::ReturnedResource::New(); + ReturnedResourcePtr returned = ReturnedResource::New(); returned->id = input.id; returned->sync_point = input.sync_point; returned->count = input.count; @@ -397,8 +391,8 @@ TypeConverter<surfaces::ReturnedResourcePtr, cc::ReturnedResource>::ConvertFrom( // static cc::ReturnedResource -TypeConverter<surfaces::ReturnedResourcePtr, cc::ReturnedResource>::ConvertTo( - const surfaces::ReturnedResourcePtr& input) { +TypeConverter<ReturnedResourcePtr, cc::ReturnedResource>::ConvertTo( + const ReturnedResourcePtr& input) { cc::ReturnedResource returned; returned.id = input->id; returned.sync_point = input->sync_point; @@ -408,36 +402,35 @@ TypeConverter<surfaces::ReturnedResourcePtr, cc::ReturnedResource>::ConvertTo( } // static -Array<surfaces::ReturnedResourcePtr> TypeConverter< - Array<surfaces::ReturnedResourcePtr>, +Array<ReturnedResourcePtr> TypeConverter< + Array<ReturnedResourcePtr>, cc::ReturnedResourceArray>::ConvertFrom(const cc::ReturnedResourceArray& input) { - Array<surfaces::ReturnedResourcePtr> resources(input.size()); + Array<ReturnedResourcePtr> resources(input.size()); for (size_t i = 0; i < input.size(); ++i) { - resources[i] = surfaces::ReturnedResource::From(input[i]); + resources[i] = ReturnedResource::From(input[i]); } return resources.Pass(); } // static -surfaces::FramePtr -TypeConverter<surfaces::FramePtr, cc::CompositorFrame>::ConvertFrom( +FramePtr TypeConverter<FramePtr, cc::CompositorFrame>::ConvertFrom( const cc::CompositorFrame& input) { - surfaces::FramePtr frame = surfaces::Frame::New(); + FramePtr frame = Frame::New(); DCHECK(input.delegated_frame_data); cc::DelegatedFrameData* frame_data = input.delegated_frame_data.get(); frame->resources = - Array<surfaces::TransferableResourcePtr>::From(frame_data->resource_list); + Array<TransferableResourcePtr>::From(frame_data->resource_list); const cc::RenderPassList& pass_list = frame_data->render_pass_list; - frame->passes = Array<surfaces::PassPtr>::New(pass_list.size()); + frame->passes = Array<PassPtr>::New(pass_list.size()); for (size_t i = 0; i < pass_list.size(); ++i) { - frame->passes[i] = surfaces::Pass::From(*pass_list[i]); + frame->passes[i] = Pass::From(*pass_list[i]); } return frame.Pass(); } // static -scoped_ptr<cc::CompositorFrame> ConvertTo(const surfaces::FramePtr& input) { +scoped_ptr<cc::CompositorFrame> ConvertTo(const FramePtr& input) { scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); frame_data->device_scale_factor = 1.f; frame_data->resource_list = diff --git a/mojo/services/public/cpp/surfaces/surfaces_type_converters.h b/mojo/services/public/cpp/surfaces/surfaces_type_converters.h index f51e825..9fdc9df 100644 --- a/mojo/services/public/cpp/surfaces/surfaces_type_converters.h +++ b/mojo/services/public/cpp/surfaces/surfaces_type_converters.h @@ -29,110 +29,105 @@ namespace mojo { // Types from surface_id.mojom template <> class MOJO_SURFACES_EXPORT -TypeConverter<surfaces::SurfaceIdPtr, cc::SurfaceId> { +TypeConverter<SurfaceIdPtr, cc::SurfaceId> { public: - static surfaces::SurfaceIdPtr ConvertFrom(const cc::SurfaceId& input); - static cc::SurfaceId ConvertTo(const surfaces::SurfaceIdPtr& input); + static SurfaceIdPtr ConvertFrom(const cc::SurfaceId& input); + static cc::SurfaceId ConvertTo(const SurfaceIdPtr& input); }; // Types from quads.mojom template <> -class MOJO_SURFACES_EXPORT TypeConverter<surfaces::ColorPtr, SkColor> { +class MOJO_SURFACES_EXPORT TypeConverter<ColorPtr, SkColor> { public: - static surfaces::ColorPtr ConvertFrom(const SkColor& input); - static SkColor ConvertTo(const surfaces::ColorPtr& input); + static ColorPtr ConvertFrom(const SkColor& input); + static SkColor ConvertTo(const ColorPtr& input); }; template <> -class MOJO_SURFACES_EXPORT TypeConverter<surfaces::QuadPtr, cc::DrawQuad> { +class MOJO_SURFACES_EXPORT TypeConverter<QuadPtr, cc::DrawQuad> { public: - static surfaces::QuadPtr ConvertFrom(const cc::DrawQuad& input); + static QuadPtr ConvertFrom(const cc::DrawQuad& input); }; template <> class MOJO_SURFACES_EXPORT -TypeConverter<surfaces::SharedQuadStatePtr, cc::SharedQuadState> { +TypeConverter<SharedQuadStatePtr, cc::SharedQuadState> { public: - static surfaces::SharedQuadStatePtr ConvertFrom( - const cc::SharedQuadState& input); + static SharedQuadStatePtr ConvertFrom(const cc::SharedQuadState& input); }; template <> -class MOJO_SURFACES_EXPORT TypeConverter<surfaces::PassPtr, cc::RenderPass> { +class MOJO_SURFACES_EXPORT TypeConverter<PassPtr, cc::RenderPass> { public: - static surfaces::PassPtr ConvertFrom(const cc::RenderPass& input); + static PassPtr ConvertFrom(const cc::RenderPass& input); }; // This can't use the TypeConverter since cc::RenderPass must be heap allocated // and isn't copyable. MOJO_SURFACES_EXPORT scoped_ptr<cc::RenderPass> ConvertTo( - const surfaces::PassPtr& input); + const PassPtr& input); // Types from surfaces.mojom template <> -class MOJO_SURFACES_EXPORT TypeConverter<surfaces::MailboxPtr, gpu::Mailbox> { +class MOJO_SURFACES_EXPORT TypeConverter<MailboxPtr, gpu::Mailbox> { public: - static surfaces::MailboxPtr ConvertFrom(const gpu::Mailbox& input); - static gpu::Mailbox ConvertTo(const surfaces::MailboxPtr& input); + static MailboxPtr ConvertFrom(const gpu::Mailbox& input); + static gpu::Mailbox ConvertTo(const MailboxPtr& input); }; template <> class MOJO_SURFACES_EXPORT -TypeConverter<surfaces::MailboxHolderPtr, gpu::MailboxHolder> { +TypeConverter<MailboxHolderPtr, gpu::MailboxHolder> { public: - static surfaces::MailboxHolderPtr ConvertFrom( - const gpu::MailboxHolder& input); - static gpu::MailboxHolder ConvertTo(const surfaces::MailboxHolderPtr& input); + static MailboxHolderPtr ConvertFrom(const gpu::MailboxHolder& input); + static gpu::MailboxHolder ConvertTo(const MailboxHolderPtr& input); }; template <> class MOJO_SURFACES_EXPORT -TypeConverter<surfaces::TransferableResourcePtr, cc::TransferableResource> { +TypeConverter<TransferableResourcePtr, cc::TransferableResource> { public: - static surfaces::TransferableResourcePtr ConvertFrom( + static TransferableResourcePtr ConvertFrom( const cc::TransferableResource& input); static cc::TransferableResource ConvertTo( - const surfaces::TransferableResourcePtr& input); + const TransferableResourcePtr& input); }; template <> class MOJO_SURFACES_EXPORT -TypeConverter<Array<surfaces::TransferableResourcePtr>, - cc::TransferableResourceArray> { +TypeConverter<Array<TransferableResourcePtr>, cc::TransferableResourceArray> { public: - static Array<surfaces::TransferableResourcePtr> ConvertFrom( + static Array<TransferableResourcePtr> ConvertFrom( const cc::TransferableResourceArray& input); static cc::TransferableResourceArray ConvertTo( - const Array<surfaces::TransferableResourcePtr>& input); + const Array<TransferableResourcePtr>& input); }; template <> class MOJO_SURFACES_EXPORT -TypeConverter<surfaces::ReturnedResourcePtr, cc::ReturnedResource> { +TypeConverter<ReturnedResourcePtr, cc::ReturnedResource> { public: - static surfaces::ReturnedResourcePtr ConvertFrom( - const cc::ReturnedResource& input); - static cc::ReturnedResource ConvertTo( - const surfaces::ReturnedResourcePtr& input); + static ReturnedResourcePtr ConvertFrom(const cc::ReturnedResource& input); + static cc::ReturnedResource ConvertTo(const ReturnedResourcePtr& input); }; template <> class MOJO_SURFACES_EXPORT -TypeConverter<Array<surfaces::ReturnedResourcePtr>, cc::ReturnedResourceArray> { +TypeConverter<Array<ReturnedResourcePtr>, cc::ReturnedResourceArray> { public: - static Array<surfaces::ReturnedResourcePtr> ConvertFrom( + static Array<ReturnedResourcePtr> ConvertFrom( const cc::ReturnedResourceArray& input); }; template <> class MOJO_SURFACES_EXPORT -TypeConverter<surfaces::FramePtr, cc::CompositorFrame> { +TypeConverter<FramePtr, cc::CompositorFrame> { public: - static surfaces::FramePtr ConvertFrom(const cc::CompositorFrame& input); + static FramePtr ConvertFrom(const cc::CompositorFrame& input); }; MOJO_SURFACES_EXPORT scoped_ptr<cc::CompositorFrame> ConvertTo( - const surfaces::FramePtr& input); + const FramePtr& input); } // namespace mojo diff --git a/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc b/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc index b0cb8bfa..bc933c3 100644 --- a/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc +++ b/mojo/services/public/cpp/surfaces/tests/surface_unittest.cc @@ -19,22 +19,20 @@ namespace { TEST(SurfaceLibTest, SurfaceIdConverterNullId) { cc::SurfaceId null_id; - cc::SurfaceId round_trip = - surfaces::SurfaceId::From(null_id).To<cc::SurfaceId>(); + cc::SurfaceId round_trip = SurfaceId::From(null_id).To<cc::SurfaceId>(); EXPECT_TRUE(round_trip.is_null()); } TEST(SurfaceLibTest, SurfaceIdConverterValidId) { cc::SurfaceId valid_id(7); - cc::SurfaceId round_trip = - surfaces::SurfaceId::From(valid_id).To<cc::SurfaceId>(); + cc::SurfaceId round_trip = SurfaceId::From(valid_id).To<cc::SurfaceId>(); EXPECT_FALSE(round_trip.is_null()); EXPECT_EQ(valid_id, round_trip); } TEST(SurfaceLibTest, Color) { SkColor arbitrary_color = SK_ColorMAGENTA; - SkColor round_trip = surfaces::Color::From(arbitrary_color).To<SkColor>(); + SkColor round_trip = Color::From(arbitrary_color).To<SkColor>(); EXPECT_EQ(arbitrary_color, round_trip); } @@ -71,17 +69,16 @@ TEST_F(SurfaceLibQuadTest, ColorQuad) { arbitrary_color, force_anti_aliasing_off); - surfaces::QuadPtr mojo_quad = surfaces::Quad::From(*(pass->quad_list.back())); + QuadPtr mojo_quad = Quad::From(*(pass->quad_list.back())); ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(surfaces::MATERIAL_SOLID_COLOR, mojo_quad->material); + EXPECT_EQ(MATERIAL_SOLID_COLOR, mojo_quad->material); EXPECT_EQ(Rect::From(rect), mojo_quad->rect); EXPECT_EQ(Rect::From(opaque_rect), mojo_quad->opaque_rect); EXPECT_EQ(Rect::From(visible_rect), mojo_quad->visible_rect); EXPECT_EQ(needs_blending, mojo_quad->needs_blending); ASSERT_TRUE(mojo_quad->solid_color_quad_state); - surfaces::SolidColorQuadStatePtr& mojo_color_state = - mojo_quad->solid_color_quad_state; - EXPECT_EQ(surfaces::Color::From(arbitrary_color), mojo_color_state->color); + SolidColorQuadStatePtr& mojo_color_state = mojo_quad->solid_color_quad_state; + EXPECT_EQ(Color::From(arbitrary_color), mojo_color_state->color); EXPECT_EQ(force_anti_aliasing_off, mojo_color_state->force_anti_aliasing_off); } @@ -92,13 +89,12 @@ TEST_F(SurfaceLibQuadTest, SurfaceQuad) { surface_quad->SetAll( sqs, rect, opaque_rect, visible_rect, needs_blending, arbitrary_id); - surfaces::QuadPtr mojo_quad = surfaces::Quad::From(*(pass->quad_list.back())); + QuadPtr mojo_quad = Quad::From(*(pass->quad_list.back())); ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(surfaces::MATERIAL_SURFACE_CONTENT, mojo_quad->material); + EXPECT_EQ(MATERIAL_SURFACE_CONTENT, mojo_quad->material); ASSERT_TRUE(mojo_quad->surface_quad_state); - surfaces::SurfaceQuadStatePtr& mojo_surface_state = - mojo_quad->surface_quad_state; - EXPECT_EQ(surfaces::SurfaceId::From(arbitrary_id), + SurfaceQuadStatePtr& mojo_surface_state = mojo_quad->surface_quad_state; + EXPECT_EQ(SurfaceId::From(arbitrary_id), mojo_surface_state->surface); } @@ -125,17 +121,16 @@ TEST_F(SurfaceLibQuadTest, TextureQuad) { vertex_opacity, flipped); - surfaces::QuadPtr mojo_quad = surfaces::Quad::From(*(pass->quad_list.back())); + QuadPtr mojo_quad = Quad::From(*(pass->quad_list.back())); ASSERT_FALSE(mojo_quad.is_null()); - EXPECT_EQ(surfaces::MATERIAL_TEXTURE_CONTENT, mojo_quad->material); + EXPECT_EQ(MATERIAL_TEXTURE_CONTENT, mojo_quad->material); ASSERT_TRUE(mojo_quad->texture_quad_state); - surfaces::TextureQuadStatePtr& mojo_texture_state = - mojo_quad->texture_quad_state; + TextureQuadStatePtr& mojo_texture_state = mojo_quad->texture_quad_state; EXPECT_EQ(resource_id, mojo_texture_state->resource_id); EXPECT_EQ(premultiplied_alpha, mojo_texture_state->premultiplied_alpha); EXPECT_EQ(PointF::From(uv_top_left), mojo_texture_state->uv_top_left); EXPECT_EQ(PointF::From(uv_bottom_right), mojo_texture_state->uv_bottom_right); - EXPECT_EQ(surfaces::Color::From(background_color), + EXPECT_EQ(Color::From(background_color), mojo_texture_state->background_color); for (size_t i = 0; i < 4; ++i) { EXPECT_EQ(vertex_opacity[i], mojo_texture_state->vertex_opacity[i]) << i; @@ -144,15 +139,14 @@ TEST_F(SurfaceLibQuadTest, TextureQuad) { } TEST_F(SurfaceLibQuadTest, TextureQuadEmptyVertexOpacity) { - surfaces::QuadPtr mojo_texture_quad = surfaces::Quad::New(); - mojo_texture_quad->material = surfaces::MATERIAL_TEXTURE_CONTENT; - surfaces::TextureQuadStatePtr mojo_texture_state = - surfaces::TextureQuadState::New(); - mojo_texture_state->background_color = surfaces::Color::New(); + QuadPtr mojo_texture_quad = Quad::New(); + mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; + TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); + mojo_texture_state->background_color = Color::New(); mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); - surfaces::PassPtr mojo_pass = surfaces::Pass::New(); + PassPtr mojo_pass = Pass::New(); mojo_pass->quads.push_back(mojo_texture_quad.Pass()); - surfaces::SharedQuadStatePtr mojo_sqs = surfaces::SharedQuadState::New(); + SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); scoped_ptr<cc::RenderPass> pass = ConvertTo(mojo_pass.Pass()); @@ -160,15 +154,14 @@ TEST_F(SurfaceLibQuadTest, TextureQuadEmptyVertexOpacity) { } TEST_F(SurfaceLibQuadTest, TextureQuadEmptyBackgroundColor) { - surfaces::QuadPtr mojo_texture_quad = surfaces::Quad::New(); - mojo_texture_quad->material = surfaces::MATERIAL_TEXTURE_CONTENT; - surfaces::TextureQuadStatePtr mojo_texture_state = - surfaces::TextureQuadState::New(); + QuadPtr mojo_texture_quad = Quad::New(); + mojo_texture_quad->material = MATERIAL_TEXTURE_CONTENT; + TextureQuadStatePtr mojo_texture_state = TextureQuadState::New(); mojo_texture_state->vertex_opacity = mojo::Array<float>::New(4); mojo_texture_quad->texture_quad_state = mojo_texture_state.Pass(); - surfaces::PassPtr mojo_pass = surfaces::Pass::New(); + PassPtr mojo_pass = Pass::New(); mojo_pass->quads.push_back(mojo_texture_quad.Pass()); - surfaces::SharedQuadStatePtr mojo_sqs = surfaces::SharedQuadState::New(); + SharedQuadStatePtr mojo_sqs = SharedQuadState::New(); mojo_pass->shared_quad_states.push_back(mojo_sqs.Pass()); scoped_ptr<cc::RenderPass> pass = ConvertTo(mojo_pass.Pass()); @@ -184,7 +177,7 @@ TEST(SurfaceLibTest, SharedQuadState) { bool is_clipped = true; float opacity = 0.65f; int sorting_context_id = 13; - SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; + ::SkXfermode::Mode blend_mode = ::SkXfermode::kSrcOver_Mode; scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); sqs->SetAll(content_to_target_transform, @@ -196,7 +189,7 @@ TEST(SurfaceLibTest, SharedQuadState) { blend_mode, sorting_context_id); - surfaces::SharedQuadStatePtr mojo_sqs = surfaces::SharedQuadState::From(*sqs); + SharedQuadStatePtr mojo_sqs = SharedQuadState::From(*sqs); ASSERT_FALSE(mojo_sqs.is_null()); EXPECT_EQ(Transform::From(content_to_target_transform), mojo_sqs->content_to_target_transform); @@ -230,7 +223,7 @@ TEST(SurfaceLibTest, RenderPass) { bool is_clipped = true; float opacity = 0.65f; int sorting_context_id = 13; - SkXfermode::Mode blend_mode = SkXfermode::kSrcOver_Mode; + ::SkXfermode::Mode blend_mode = ::SkXfermode::kSrcOver_Mode; cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); sqs->SetAll(content_to_target_transform, content_bounds, @@ -286,7 +279,7 @@ TEST(SurfaceLibTest, RenderPass) { vertex_opacity, flipped); - surfaces::PassPtr mojo_pass = surfaces::Pass::From(*pass); + PassPtr mojo_pass = Pass::From(*pass); ASSERT_FALSE(mojo_pass.is_null()); EXPECT_EQ(6, mojo_pass->id); EXPECT_EQ(Rect::From(output_rect), mojo_pass->output_rect); @@ -363,7 +356,7 @@ TEST(SurfaceLibTest, Mailbox) { gpu::Mailbox mailbox; mailbox.Generate(); - surfaces::MailboxPtr mojo_mailbox = surfaces::Mailbox::From(mailbox); + MailboxPtr mojo_mailbox = Mailbox::From(mailbox); EXPECT_EQ(0, memcmp(mailbox.name, &mojo_mailbox->name.storage()[0], 64)); gpu::Mailbox round_trip_mailbox = mojo_mailbox.To<gpu::Mailbox>(); @@ -371,7 +364,7 @@ TEST(SurfaceLibTest, Mailbox) { } TEST(SurfaceLibTest, MailboxEmptyName) { - surfaces::MailboxPtr mojo_mailbox = surfaces::Mailbox::New(); + MailboxPtr mojo_mailbox = Mailbox::New(); gpu::Mailbox converted_mailbox = mojo_mailbox.To<gpu::Mailbox>(); EXPECT_TRUE(converted_mailbox.IsZero()); @@ -384,8 +377,7 @@ TEST(SurfaceLibTest, MailboxHolder) { uint32_t sync_point = 7u; gpu::MailboxHolder holder(mailbox, texture_target, sync_point); - surfaces::MailboxHolderPtr mojo_holder = - surfaces::MailboxHolder::From(holder); + MailboxHolderPtr mojo_holder = MailboxHolder::From(holder); EXPECT_EQ(texture_target, mojo_holder->texture_target); EXPECT_EQ(sync_point, mojo_holder->sync_point); @@ -413,10 +405,9 @@ TEST(SurfaceLibTest, TransferableResource) { resource.is_repeated = is_repeated; resource.is_software = is_software; - surfaces::TransferableResourcePtr mojo_resource = - surfaces::TransferableResource::From(resource); + TransferableResourcePtr mojo_resource = TransferableResource::From(resource); EXPECT_EQ(id, mojo_resource->id); - EXPECT_EQ(static_cast<surfaces::ResourceFormat>(format), + EXPECT_EQ(static_cast<ResourceFormat>(format), mojo_resource->format); EXPECT_EQ(filter, mojo_resource->filter); EXPECT_EQ(Size::From(size), mojo_resource->size); @@ -449,8 +440,7 @@ TEST(SurfaceLibTest, ReturnedResource) { resource.count = count; resource.lost = lost; - surfaces::ReturnedResourcePtr mojo_resource = - surfaces::ReturnedResource::From(resource); + ReturnedResourcePtr mojo_resource = ReturnedResource::From(resource); EXPECT_EQ(id, mojo_resource->id); EXPECT_EQ(sync_point, mojo_resource->sync_point); EXPECT_EQ(count, mojo_resource->count); diff --git a/mojo/services/public/interfaces/launcher/launcher.mojom b/mojo/services/public/interfaces/launcher/launcher.mojom index 174ed85..12e0be1 100644 --- a/mojo/services/public/interfaces/launcher/launcher.mojom +++ b/mojo/services/public/interfaces/launcher/launcher.mojom @@ -4,7 +4,7 @@ import "mojo/services/public/interfaces/navigation/navigation.mojom" -module mojo.launcher { +module mojo { interface Launcher { // Determines the correct handler application that can render a given URL. @@ -24,7 +24,7 @@ interface Launcher { // Note: |response| can be NULL in the case where a request was not needed to // determine the correct handler. Launch(string url) => (string handler_url, string view_url, - mojo.navigation.ResponseDetails response); + ResponseDetails response); }; } diff --git a/mojo/services/public/interfaces/navigation/navigation.mojom b/mojo/services/public/interfaces/navigation/navigation.mojom index fd51d06..d012308 100644 --- a/mojo/services/public/interfaces/navigation/navigation.mojom +++ b/mojo/services/public/interfaces/navigation/navigation.mojom @@ -4,7 +4,7 @@ import "mojo/services/public/interfaces/network/url_loader.mojom" -module mojo.navigation { +module mojo { // Expresses a preference for where a navigation will be performed. enum Target { diff --git a/mojo/services/public/interfaces/surfaces/quads.mojom b/mojo/services/public/interfaces/surfaces/quads.mojom index b6b67a4..6c2eb64 100644 --- a/mojo/services/public/interfaces/surfaces/quads.mojom +++ b/mojo/services/public/interfaces/surfaces/quads.mojom @@ -5,7 +5,7 @@ import "mojo/services/public/interfaces/geometry/geometry.mojom" import "mojo/services/public/interfaces/surfaces/surface_id.mojom" -module mojo.surfaces { +module mojo { struct Color { uint32 rgba; @@ -81,7 +81,7 @@ struct Quad { // Index into the containing pass' shared quad state array which has state // (transforms etc) shared by multiple quads. int32 shared_quad_state_index; - + // Only one of the following will be set, depending on the material. CheckerboardQuadState checkerboard_quad_state; DebugBorderQuadState debug_border_quad_state; diff --git a/mojo/services/public/interfaces/surfaces/surface_id.mojom b/mojo/services/public/interfaces/surfaces/surface_id.mojom index 2722f4e..5a7686d 100644 --- a/mojo/services/public/interfaces/surfaces/surface_id.mojom +++ b/mojo/services/public/interfaces/surfaces/surface_id.mojom @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -module mojo.surfaces { +module mojo { struct SurfaceId { uint64 id; diff --git a/mojo/services/public/interfaces/surfaces/surfaces.mojom b/mojo/services/public/interfaces/surfaces/surfaces.mojom index 29e1efa..1837440 100644 --- a/mojo/services/public/interfaces/surfaces/surfaces.mojom +++ b/mojo/services/public/interfaces/surfaces/surfaces.mojom @@ -7,7 +7,7 @@ import "mojo/services/gles2/command_buffer.mojom" import "mojo/services/public/interfaces/surfaces/quads.mojom" import "mojo/services/public/interfaces/surfaces/surface_id.mojom" -module mojo.surfaces { +module mojo { enum ResourceFormat { RGBA_8888, @@ -32,7 +32,7 @@ struct TransferableResource { uint32 id; ResourceFormat format; uint32 filter; - mojo.Size size; + Size size; MailboxHolder mailbox_holder; bool is_repeated; bool is_software; @@ -57,13 +57,13 @@ interface SurfaceClient { [Client=SurfaceClient] interface Surface { - CreateSurface(SurfaceId id, mojo.Size size); + CreateSurface(SurfaceId id, Size size); SubmitFrame(SurfaceId id, Frame frame); DestroySurface(SurfaceId id); - CreateGLES2BoundSurface(mojo.CommandBuffer gles2_client, + CreateGLES2BoundSurface(CommandBuffer gles2_client, SurfaceId id, - mojo.Size size); + Size size); }; } diff --git a/mojo/services/surfaces/surfaces_impl.cc b/mojo/services/surfaces/surfaces_impl.cc index 5baaf60..141d0c4 100644 --- a/mojo/services/surfaces/surfaces_impl.cc +++ b/mojo/services/surfaces/surfaces_impl.cc @@ -14,7 +14,6 @@ #include "mojo/services/public/cpp/surfaces/surfaces_type_converters.h" namespace mojo { -namespace surfaces { SurfacesImpl::SurfacesImpl(cc::SurfaceManager* manager, uint32_t id_namespace, @@ -97,5 +96,4 @@ scoped_ptr<cc::OutputSurface> SurfacesImpl::CreateOutputSurface() { new ContextProviderMojo(command_buffer_handle_.Pass()))); } -} // namespace surfaces } // namespace mojo diff --git a/mojo/services/surfaces/surfaces_impl.h b/mojo/services/surfaces/surfaces_impl.h index 21f2daa..28ac9ce 100644 --- a/mojo/services/surfaces/surfaces_impl.h +++ b/mojo/services/surfaces/surfaces_impl.h @@ -20,8 +20,6 @@ class Display; namespace mojo { class ServiceManager; -namespace surfaces { - class SurfaceNativeViewportClient; class SurfacesImpl : public InterfaceImpl<Surface>, @@ -70,7 +68,6 @@ class SurfacesImpl : public InterfaceImpl<Surface>, DISALLOW_COPY_AND_ASSIGN(SurfacesImpl); }; -} // namespace surfaces } // namespace mojo #endif // MOJO_SERVICES_SURFACES_SURFACES_IMPL_H_ diff --git a/mojo/services/surfaces/surfaces_service_application.cc b/mojo/services/surfaces/surfaces_service_application.cc index 0bc440b..3eaadd7 100644 --- a/mojo/services/surfaces/surfaces_service_application.cc +++ b/mojo/services/surfaces/surfaces_service_application.cc @@ -7,7 +7,6 @@ #include "cc/surfaces/display.h" namespace mojo { -namespace surfaces { SurfacesServiceApplication::SurfacesServiceApplication() : next_id_namespace_(1u), display_(NULL) { @@ -37,11 +36,9 @@ void SurfacesServiceApplication::SetDisplay(cc::Display* display) { display_ = display; } -} // namespace surfaces - // static ApplicationDelegate* ApplicationDelegate::Create() { - return new surfaces::SurfacesServiceApplication; + return new SurfacesServiceApplication; } } // namespace mojo diff --git a/mojo/services/surfaces/surfaces_service_application.h b/mojo/services/surfaces/surfaces_service_application.h index 75ca540..bf45a81 100644 --- a/mojo/services/surfaces/surfaces_service_application.h +++ b/mojo/services/surfaces/surfaces_service_application.h @@ -13,8 +13,6 @@ namespace mojo { class ApplicationConnection; -namespace surfaces { - class SurfacesServiceApplication : public ApplicationDelegate, public InterfaceFactory<Surface>, public SurfacesImpl::Client { @@ -42,7 +40,6 @@ class SurfacesServiceApplication : public ApplicationDelegate, DISALLOW_COPY_AND_ASSIGN(SurfacesServiceApplication); }; -} // namespace surfaces } // namespace mojo #endif // MOJO_SERVICES_SURFACES_SURFACES_SERVICE_APPLICATION_H_ |