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

Unified Diff: chrome/browser/ui/extensions/native_shell_window.cc

Issue 11028125: Remove legacy draggable region code and refactor to share common draggable region code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch Created 8 years, 2 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
Index: chrome/browser/ui/extensions/native_shell_window.cc
diff --git a/chrome/browser/ui/extensions/native_shell_window.cc b/chrome/browser/ui/extensions/native_shell_window.cc
new file mode 100644
index 0000000000000000000000000000000000000000..638e1ecfd148953a5ad61b1415ac40b0b87c4991
--- /dev/null
+++ b/chrome/browser/ui/extensions/native_shell_window.cc
@@ -0,0 +1,38 @@
+// Copyright (c) 2012 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 "chrome/browser/ui/extensions/native_shell_window.h"
+
+#include "chrome/common/extensions/draggable_region.h"
+
+NativeShellWindow::NativeShellWindow(const ShellWindow::CreateParams& params)
+ : frameless_(params.frame == ShellWindow::CreateParams::FRAME_NONE) {
+}
+
+NativeShellWindow::~NativeShellWindow() {
+}
+
+void NativeShellWindow::UpdateDraggableRegions(
+ const std::vector<extensions::DraggableRegion>& regions) {
+ // Draggable region is not supported for non-frameless window.
+ if (!frameless_)
+ return;
+
+ draggable_regions_.reset(new SkRegion);
+ for (std::vector<extensions::DraggableRegion>::const_iterator iter =
+ regions.begin();
+ iter != regions.end(); ++iter) {
+ const extensions::DraggableRegion& region = *iter;
+ draggable_regions_->op(
+ region.bounds.x(),
+ region.bounds.y(),
+ region.bounds.right(),
+ region.bounds.bottom(),
+ region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op);
+ }
+}
+
+bool NativeShellWindow::IsInsideDraggableRegions(int x, int y) const {
+ return frameless_ && draggable_regions_ && draggable_regions_->contains(x, y);
+}

Powered by Google App Engine
This is Rietveld 408576698