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

Unified Diff: mojo/services/view_manager/view_coordinate_conversions.cc

Issue 774473003: Move view_manager service implementation to //services (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
Index: mojo/services/view_manager/view_coordinate_conversions.cc
diff --git a/mojo/services/view_manager/view_coordinate_conversions.cc b/mojo/services/view_manager/view_coordinate_conversions.cc
deleted file mode 100644
index 804362c85e74edff754f6f0109d0eee3fd35df72..0000000000000000000000000000000000000000
--- a/mojo/services/view_manager/view_coordinate_conversions.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/services/view_manager/view_coordinate_conversions.h"
-
-#include "mojo/services/view_manager/server_view.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/vector2d.h"
-
-namespace mojo {
-namespace service {
-
-namespace {
-
-gfx::Vector2d CalculateOffsetToAncestor(const ServerView* view,
- const ServerView* ancestor) {
- DCHECK(ancestor->Contains(view));
- gfx::Vector2d result;
- for (const ServerView* v = view; v != ancestor; v = v->parent())
- result += v->bounds().OffsetFromOrigin();
- return result;
-}
-
-} // namespace
-
-gfx::Rect ConvertRectBetweenViews(const ServerView* from,
- const ServerView* to,
- const gfx::Rect& rect) {
- DCHECK(from);
- if (from == to)
- return rect;
-
- if (from->Contains(to)) {
- const gfx::Vector2d offset(CalculateOffsetToAncestor(to, from));
- return gfx::Rect(rect.origin() - offset, rect.size());
- }
- DCHECK(to->Contains(from));
- const gfx::Vector2d offset(CalculateOffsetToAncestor(from, to));
- return gfx::Rect(rect.origin() + offset, rect.size());
-}
-
-} // namespace service
-} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698