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

Unified Diff: components/mus/public/cpp/lib/view.cc

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/mus/public/cpp/lib/scoped_view_ptr.cc ('k') | components/mus/public/cpp/lib/view_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/mus/public/cpp/lib/view.cc
diff --git a/components/view_manager/public/cpp/lib/view.cc b/components/mus/public/cpp/lib/view.cc
similarity index 87%
rename from components/view_manager/public/cpp/lib/view.cc
rename to components/mus/public/cpp/lib/view.cc
index 4157735e427848159bfb668260daa8ea0723e401..97dfef56fb95f802bb69bf892a2010a89345f912 100644
--- a/components/view_manager/public/cpp/lib/view.cc
+++ b/components/mus/public/cpp/lib/view.cc
@@ -2,17 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/view_manager/public/cpp/view.h"
+#include "components/mus/public/cpp/view.h"
#include <set>
#include <string>
#include "base/bind.h"
-#include "components/view_manager/public/cpp/lib/view_private.h"
-#include "components/view_manager/public/cpp/lib/view_tree_client_impl.h"
-#include "components/view_manager/public/cpp/view_observer.h"
-#include "components/view_manager/public/cpp/view_surface.h"
-#include "components/view_manager/public/cpp/view_tracker.h"
+#include "components/mus/public/cpp/lib/view_private.h"
+#include "components/mus/public/cpp/lib/view_tree_client_impl.h"
+#include "components/mus/public/cpp/view_observer.h"
+#include "components/mus/public/cpp/view_surface.h"
+#include "components/mus/public/cpp/view_tracker.h"
#include "mojo/application/public/cpp/service_provider_impl.h"
namespace mojo {
@@ -26,37 +26,32 @@ void NotifyViewTreeChangeAtReceiver(
ViewObserver::TreeChangeParams local_params = params;
local_params.receiver = receiver;
if (change_applied) {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(receiver).observers(),
+ FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(receiver).observers(),
OnTreeChanged(local_params));
} else {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(receiver).observers(),
+ FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(receiver).observers(),
OnTreeChanging(local_params));
}
}
-void NotifyViewTreeChangeUp(
- View* start_at,
- const ViewObserver::TreeChangeParams& params,
- bool change_applied) {
+void NotifyViewTreeChangeUp(View* start_at,
+ const ViewObserver::TreeChangeParams& params,
+ bool change_applied) {
for (View* current = start_at; current; current = current->parent())
NotifyViewTreeChangeAtReceiver(current, params, change_applied);
}
-void NotifyViewTreeChangeDown(
- View* start_at,
- const ViewObserver::TreeChangeParams& params,
- bool change_applied) {
+void NotifyViewTreeChangeDown(View* start_at,
+ const ViewObserver::TreeChangeParams& params,
+ bool change_applied) {
NotifyViewTreeChangeAtReceiver(start_at, params, change_applied);
View::Children::const_iterator it = start_at->children().begin();
for (; it != start_at->children().end(); ++it)
NotifyViewTreeChangeDown(*it, params, change_applied);
}
-void NotifyViewTreeChange(
- const ViewObserver::TreeChangeParams& params,
- bool change_applied) {
+void NotifyViewTreeChange(const ViewObserver::TreeChangeParams& params,
+ bool change_applied) {
NotifyViewTreeChangeDown(params.target, params, change_applied);
if (params.old_parent)
NotifyViewTreeChangeUp(params.old_parent, params, change_applied);
@@ -72,9 +67,7 @@ class ScopedTreeNotifier {
params_.new_parent = new_parent;
NotifyViewTreeChange(params_, false);
}
- ~ScopedTreeNotifier() {
- NotifyViewTreeChange(params_, true);
- }
+ ~ScopedTreeNotifier() { NotifyViewTreeChange(params_, true); }
private:
ViewObserver::TreeChangeParams params_;
@@ -96,16 +89,12 @@ class ScopedOrderChangedNotifier {
ScopedOrderChangedNotifier(View* view,
View* relative_view,
OrderDirection direction)
- : view_(view),
- relative_view_(relative_view),
- direction_(direction) {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(view_).observers(),
+ : view_(view), relative_view_(relative_view), direction_(direction) {
+ FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(),
OnViewReordering(view_, relative_view_, direction_));
}
~ScopedOrderChangedNotifier() {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(view_).observers(),
+ FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(),
OnViewReordered(view_, relative_view_, direction_));
}
@@ -152,16 +141,12 @@ class ScopedSetBoundsNotifier {
ScopedSetBoundsNotifier(View* view,
const Rect& old_bounds,
const Rect& new_bounds)
- : view_(view),
- old_bounds_(old_bounds),
- new_bounds_(new_bounds) {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(view_).observers(),
+ : view_(view), old_bounds_(old_bounds), new_bounds_(new_bounds) {
+ FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(),
OnViewBoundsChanging(view_, old_bounds_, new_bounds_));
}
~ScopedSetBoundsNotifier() {
- FOR_EACH_OBSERVER(ViewObserver,
- *ViewPrivate(view_).observers(),
+ FOR_EACH_OBSERVER(ViewObserver, *ViewPrivate(view_).observers(),
OnViewBoundsChanged(view_, old_bounds_, new_bounds_));
}
@@ -176,7 +161,7 @@ class ScopedSetBoundsNotifier {
// Some operations are only permitted in the connection that created the view.
bool OwnsView(ViewTreeConnection* connection, View* view) {
return !connection ||
- static_cast<ViewTreeClientImpl*>(connection)->OwnsView(view->id());
+ static_cast<ViewTreeClientImpl*>(connection)->OwnsView(view->id());
}
void EmptyEmbedCallback(bool result, ConnectionSpecificId connection_id) {}
@@ -231,10 +216,10 @@ scoped_ptr<mojo::ViewSurface> View::RequestSurface() {
mojo::SurfacePtr surface;
mojo::SurfaceClientPtr client;
mojo::InterfaceRequest<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()));
+ static_cast<ViewTreeClientImpl*>(connection_)
+ ->RequestSurface(id_, GetProxy(&surface), client.Pass());
+ return make_scoped_ptr(
+ new mojo::ViewSurface(surface.PassInterface(), client_request.Pass()));
}
void View::SetSharedProperty(const std::string& name,
@@ -268,8 +253,8 @@ void View::SetSharedProperty(const std::string& name,
if (value->size())
memcpy(&transport_value.front(), &(value->front()), value->size());
}
- static_cast<ViewTreeClientImpl*>(connection_)->SetProperty(
- id_, name, transport_value.Pass());
+ static_cast<ViewTreeClientImpl*>(connection_)
+ ->SetProperty(id_, name, transport_value.Pass());
}
FOR_EACH_OBSERVER(
@@ -322,8 +307,8 @@ void View::RemoveChild(View* child) {
CHECK_EQ(child->connection(), connection_);
LocalRemoveChild(child);
if (connection_) {
- static_cast<ViewTreeClientImpl*>(connection_)->RemoveChild(child->id(),
- id_);
+ static_cast<ViewTreeClientImpl*>(connection_)
+ ->RemoveChild(child->id(), id_);
}
}
@@ -343,8 +328,8 @@ void View::Reorder(View* relative, OrderDirection direction) {
if (!LocalReorder(relative, direction))
return;
if (connection_) {
- static_cast<ViewTreeClientImpl*>(connection_)->Reorder(id_, relative->id(),
- direction);
+ static_cast<ViewTreeClientImpl*>(connection_)
+ ->Reorder(id_, relative->id(), direction);
}
}
@@ -434,8 +419,7 @@ View::View()
parent_(NULL),
viewport_metrics_(CreateEmptyViewportMetrics()),
visible_(true),
- drawn_(false) {
-}
+ drawn_(false) {}
View::~View() {
FOR_EACH_OBSERVER(ViewObserver, observers_, OnViewDestroying(this));
@@ -477,8 +461,7 @@ View::View(ViewTreeConnection* connection, Id id)
parent_(nullptr),
viewport_metrics_(CreateEmptyViewportMetrics()),
visible_(false),
- drawn_(false) {
-}
+ drawn_(false) {}
int64 View::SetLocalPropertyInternal(const void* key,
const char* name,
@@ -530,8 +513,7 @@ bool View::LocalReorder(View* relative, OrderDirection direction) {
return ReorderImpl(&parent_->children_, this, relative, direction);
}
-void View::LocalSetBounds(const Rect& old_bounds,
- const Rect& new_bounds) {
+void View::LocalSetBounds(const Rect& old_bounds, const Rect& new_bounds) {
DCHECK(old_bounds.x == bounds_.x);
DCHECK(old_bounds.y == bounds_.y);
DCHECK(old_bounds.width == bounds_.width);
@@ -575,7 +557,7 @@ void View::LocalSetVisible(bool visible) {
void View::NotifyViewVisibilityChanged(View* target) {
if (!NotifyViewVisibilityChangedDown(target)) {
- return; // |this| has been deleted.
+ return; // |this| has been deleted.
}
NotifyViewVisibilityChangedUp(target);
}
@@ -592,7 +574,7 @@ bool View::NotifyViewVisibilityChangedAtReceiver(View* target) {
bool View::NotifyViewVisibilityChangedDown(View* target) {
if (!NotifyViewVisibilityChangedAtReceiver(target))
- return false; // |this| was deleted.
+ return false; // |this| was deleted.
std::set<const View*> child_already_processed;
bool child_destroyed = false;
do {
« no previous file with comments | « components/mus/public/cpp/lib/scoped_view_ptr.cc ('k') | components/mus/public/cpp/lib/view_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698