Index: components/mus/public/cpp/lib/view.cc |
diff --git a/components/mus/public/cpp/lib/view.cc b/components/mus/public/cpp/lib/view.cc |
index fe7803650fa4b6511ad768742eb7398f4a10b541..88228eba945e901ba770e8277d8ac192a16d60c7 100644 |
--- a/components/mus/public/cpp/lib/view.cc |
+++ b/components/mus/public/cpp/lib/view.cc |
@@ -15,7 +15,7 @@ |
#include "components/mus/public/cpp/view_tracker.h" |
#include "mojo/application/public/cpp/service_provider_impl.h" |
-namespace mojo { |
+namespace mus { |
namespace { |
@@ -88,7 +88,7 @@ class ScopedOrderChangedNotifier { |
public: |
ScopedOrderChangedNotifier(View* view, |
View* relative_view, |
- OrderDirection direction) |
+ mojo::OrderDirection direction) |
: view_(view), relative_view_(relative_view), direction_(direction) { |
FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), |
OnViewReordering(view_, relative_view_, direction_)); |
@@ -101,7 +101,7 @@ class ScopedOrderChangedNotifier { |
private: |
View* view_; |
View* relative_view_; |
- OrderDirection direction_; |
+ mojo::OrderDirection direction_; |
MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedOrderChangedNotifier); |
}; |
@@ -110,7 +110,7 @@ class ScopedOrderChangedNotifier { |
bool ReorderImpl(View::Children* children, |
View* view, |
View* relative, |
- OrderDirection direction) { |
+ mojo::OrderDirection direction) { |
DCHECK(relative); |
DCHECK_NE(view, relative); |
DCHECK_EQ(view->parent(), relative->parent()); |
@@ -120,14 +120,14 @@ bool ReorderImpl(View::Children* children, |
const size_t target_i = |
std::find(children->begin(), children->end(), relative) - |
children->begin(); |
- if ((direction == ORDER_DIRECTION_ABOVE && child_i == target_i + 1) || |
- (direction == ORDER_DIRECTION_BELOW && child_i + 1 == target_i)) { |
+ if ((direction == mojo::ORDER_DIRECTION_ABOVE && child_i == target_i + 1) || |
+ (direction == mojo::ORDER_DIRECTION_BELOW && child_i + 1 == target_i)) { |
return false; |
} |
ScopedOrderChangedNotifier notifier(view, relative, direction); |
- const size_t dest_i = direction == ORDER_DIRECTION_ABOVE |
+ const size_t dest_i = direction == mojo::ORDER_DIRECTION_ABOVE |
? (child_i < target_i ? target_i : target_i + 1) |
: (child_i < target_i ? target_i - 1 : target_i); |
children->erase(children->begin() + child_i); |
@@ -139,8 +139,8 @@ bool ReorderImpl(View::Children* children, |
class ScopedSetBoundsNotifier { |
public: |
ScopedSetBoundsNotifier(View* view, |
- const Rect& old_bounds, |
- const Rect& new_bounds) |
+ const mojo::Rect& old_bounds, |
+ const mojo::Rect& new_bounds) |
: view_(view), old_bounds_(old_bounds), new_bounds_(new_bounds) { |
FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(), |
OnViewBoundsChanging(view_, old_bounds_, new_bounds_)); |
@@ -152,8 +152,8 @@ class ScopedSetBoundsNotifier { |
private: |
View* view_; |
- const Rect old_bounds_; |
- const Rect new_bounds_; |
+ const mojo::Rect old_bounds_; |
+ const mojo::Rect new_bounds_; |
MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier); |
}; |
@@ -191,7 +191,7 @@ void View::Destroy() { |
LocalDestroy(); |
} |
-void View::SetBounds(const Rect& bounds) { |
+void View::SetBounds(const mojo::Rect& bounds) { |
if (!OwnsView(connection_, this)) |
return; |
@@ -212,14 +212,15 @@ void View::SetVisible(bool value) { |
LocalSetVisible(value); |
} |
-scoped_ptr<mojo::ViewSurface> View::RequestSurface() { |
+scoped_ptr<ViewSurface> View::RequestSurface() { |
mojo::SurfacePtr surface; |
mojo::SurfaceClientPtr client; |
- mojo::InterfaceRequest<SurfaceClient> client_request = GetProxy(&client); |
+ mojo::InterfaceRequest<mojo::SurfaceClient> client_request = |
+ GetProxy(&client); |
static_cast<ViewTreeClientImpl*>(connection_) |
->RequestSurface(id_, GetProxy(&surface), client.Pass()); |
return make_scoped_ptr( |
- new mojo::ViewSurface(surface.PassInterface(), client_request.Pass())); |
+ new ViewSurface(surface.PassInterface(), client_request.Pass())); |
} |
void View::SetSharedProperty(const std::string& name, |
@@ -247,7 +248,7 @@ void View::SetSharedProperty(const std::string& name, |
// TODO: add test coverage of this (450303). |
if (connection_) { |
- Array<uint8_t> transport_value; |
+ mojo::Array<uint8_t> transport_value; |
if (value) { |
transport_value.resize(value->size()); |
if (value->size()) |
@@ -308,16 +309,16 @@ void View::RemoveChild(View* child) { |
void View::MoveToFront() { |
if (!parent_ || parent_->children_.back() == this) |
return; |
- Reorder(parent_->children_.back(), ORDER_DIRECTION_ABOVE); |
+ Reorder(parent_->children_.back(), mojo::ORDER_DIRECTION_ABOVE); |
} |
void View::MoveToBack() { |
if (!parent_ || parent_->children_.front() == this) |
return; |
- Reorder(parent_->children_.front(), ORDER_DIRECTION_BELOW); |
+ Reorder(parent_->children_.front(), mojo::ORDER_DIRECTION_BELOW); |
} |
-void View::Reorder(View* relative, OrderDirection direction) { |
+void View::Reorder(View* relative, mojo::OrderDirection direction) { |
if (!LocalReorder(relative, direction)) |
return; |
if (connection_) { |
@@ -353,16 +354,16 @@ View* View::GetChildById(Id id) { |
return NULL; |
} |
-void View::SetTextInputState(TextInputStatePtr state) { |
+void View::SetTextInputState(mojo::TextInputStatePtr state) { |
if (connection_) { |
static_cast<ViewTreeClientImpl*>(connection_) |
->SetViewTextInputState(id_, state.Pass()); |
} |
} |
-void View::SetImeVisibility(bool visible, TextInputStatePtr state) { |
+void View::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) { |
// SetImeVisibility() shouldn't be used if the view is not editable. |
- DCHECK(state.is_null() || state->type != TEXT_INPUT_TYPE_NONE); |
+ DCHECK(state.is_null() || state->type != mojo::TEXT_INPUT_TYPE_NONE); |
if (connection_) { |
static_cast<ViewTreeClientImpl*>(connection_) |
->SetImeVisibility(id_, visible, state.Pass()); |
@@ -378,12 +379,12 @@ bool View::HasFocus() const { |
return connection_ && connection_->GetFocusedView() == this; |
} |
-void View::Embed(ViewTreeClientPtr client) { |
- Embed(client.Pass(), ViewTree::ACCESS_POLICY_DEFAULT, |
+void View::Embed(mojo::ViewTreeClientPtr client) { |
+ Embed(client.Pass(), mojo::ViewTree::ACCESS_POLICY_DEFAULT, |
base::Bind(&EmptyEmbedCallback)); |
} |
-void View::Embed(ViewTreeClientPtr client, |
+void View::Embed(mojo::ViewTreeClientPtr client, |
uint32_t policy_bitmask, |
const EmbedCallback& callback) { |
if (PrepareForEmbed()) { |
@@ -399,9 +400,9 @@ void View::Embed(ViewTreeClientPtr client, |
namespace { |
-ViewportMetricsPtr CreateEmptyViewportMetrics() { |
- ViewportMetricsPtr metrics = ViewportMetrics::New(); |
- metrics->size_in_pixels = Size::New(); |
+mojo::ViewportMetricsPtr CreateEmptyViewportMetrics() { |
+ mojo::ViewportMetricsPtr metrics = mojo::ViewportMetrics::New(); |
+ metrics->size_in_pixels = mojo::Size::New(); |
// TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it |
// once that's fixed. |
return metrics.Pass(); |
@@ -505,11 +506,12 @@ void View::LocalRemoveChild(View* child) { |
RemoveChildImpl(child, &children_); |
} |
-bool View::LocalReorder(View* relative, OrderDirection direction) { |
+bool View::LocalReorder(View* relative, mojo::OrderDirection direction) { |
return ReorderImpl(&parent_->children_, this, relative, direction); |
} |
-void View::LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds) { |
+void View::LocalSetBounds(const mojo::Rect& old_bounds, |
+ const mojo::Rect& new_bounds) { |
DCHECK(old_bounds.x == bounds_.x); |
DCHECK(old_bounds.y == bounds_.y); |
DCHECK(old_bounds.width == bounds_.width); |
@@ -518,8 +520,8 @@ void View::LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds) { |
bounds_ = new_bounds; |
} |
-void View::LocalSetViewportMetrics(const ViewportMetrics& old_metrics, |
- const ViewportMetrics& new_metrics) { |
+void View::LocalSetViewportMetrics(const mojo::ViewportMetrics& old_metrics, |
+ const mojo::ViewportMetrics& new_metrics) { |
// TODO(eseidel): We could check old_metrics against viewport_metrics_. |
viewport_metrics_ = new_metrics.Clone(); |
FOR_EACH_OBSERVER( |
@@ -610,4 +612,4 @@ bool View::PrepareForEmbed() { |
return true; |
} |
-} // namespace mojo |
+} // namespace mus |