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

Side by Side Diff: chrome/browser/ui/gtk/tabs/dragged_view_gtk.cc

Issue 8196001: content: Split web_drag_dest_gtk.cc into chrome/ and content/ parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix viewgtk compile Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/tabs/dragged_view_gtk.h" 5 #include "chrome/browser/ui/gtk/tabs/dragged_view_gtk.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/stl_util.h" 12 #include "base/stl_util.h"
13 #include "chrome/browser/extensions/extension_tab_helper.h" 13 #include "chrome/browser/extensions/extension_tab_helper.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/tabs/tab_strip_model.h" 15 #include "chrome/browser/tabs/tab_strip_model.h"
16 #include "chrome/browser/themes/theme_service.h" 16 #include "chrome/browser/themes/theme_service.h"
17 #include "chrome/browser/themes/theme_service_factory.h" 17 #include "chrome/browser/themes/theme_service_factory.h"
18 #include "chrome/browser/ui/gtk/gtk_util.h" 18 #include "chrome/browser/ui/gtk/gtk_util.h"
19 #include "chrome/browser/ui/gtk/tabs/drag_data.h" 19 #include "chrome/browser/ui/gtk/tabs/drag_data.h"
20 #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h" 20 #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h"
21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
22 #include "content/browser/renderer_host/backing_store_gtk.h" 22 #include "content/browser/renderer_host/backing_store_gtk.h"
23 #include "content/browser/renderer_host/render_view_host.h" 23 #include "content/browser/renderer_host/render_view_host.h"
24 #include "content/browser/tab_contents/tab_contents.h" 24 #include "content/browser/tab_contents/tab_contents.h"
25 #include "third_party/skia/include/core/SkShader.h" 25 #include "third_party/skia/include/core/SkShader.h"
26 #include "ui/base/gtk/gtk_screen_utils.h"
26 #include "ui/base/x/x11_util.h" 27 #include "ui/base/x/x11_util.h"
27 #include "ui/gfx/gtk_util.h" 28 #include "ui/gfx/gtk_util.h"
28 29
29 namespace { 30 namespace {
30 31
31 // The size of the dragged window frame. 32 // The size of the dragged window frame.
32 const int kDragFrameBorderSize = 1; 33 const int kDragFrameBorderSize = 1;
33 const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize; 34 const int kTwiceDragFrameBorderSize = 2 * kDragFrameBorderSize;
34 35
35 // Used to scale the dragged window sizes. 36 // Used to scale the dragged window sizes.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 attached_ = true; 132 attached_ = true;
132 parent_window_width_ = window_width; 133 parent_window_width_ = window_width;
133 normal_width_ = normal_width; 134 normal_width_ = normal_width;
134 mini_width_ = mini_width; 135 mini_width_ = mini_width;
135 136
136 int dragged_tab_width = 137 int dragged_tab_width =
137 drag_data_->GetSourceTabData()->mini_ ? mini_width : normal_width; 138 drag_data_->GetSourceTabData()->mini_ ? mini_width : normal_width;
138 139
139 Resize(dragged_tab_width); 140 Resize(dragged_tab_width);
140 141
141 if (gtk_util::IsScreenComposited()) 142 if (ui::IsScreenComposited())
142 gdk_window_set_opacity(container_->window, kOpaqueAlpha); 143 gdk_window_set_opacity(container_->window, kOpaqueAlpha);
143 } 144 }
144 145
145 void DraggedViewGtk::Resize(int width) { 146 void DraggedViewGtk::Resize(int width) {
146 attached_tab_size_.set_width(width); 147 attached_tab_size_.set_width(width);
147 ResizeContainer(); 148 ResizeContainer();
148 } 149 }
149 150
150 void DraggedViewGtk::Detach() { 151 void DraggedViewGtk::Detach() {
151 attached_ = false; 152 attached_ = false;
152 ResizeContainer(); 153 ResizeContainer();
153 154
154 if (gtk_util::IsScreenComposited()) 155 if (ui::IsScreenComposited())
155 gdk_window_set_opacity(container_->window, kTransparentAlpha); 156 gdk_window_set_opacity(container_->window, kTransparentAlpha);
156 } 157 }
157 158
158 void DraggedViewGtk::Update() { 159 void DraggedViewGtk::Update() {
159 gtk_widget_queue_draw(container_); 160 gtk_widget_queue_draw(container_);
160 } 161 }
161 162
162 int DraggedViewGtk::GetWidthInTabStripFromTo(int from, int to) { 163 int DraggedViewGtk::GetWidthInTabStripFromTo(int from, int to) {
163 DCHECK(from <= static_cast<int>(drag_data_->size())); 164 DCHECK(from <= static_cast<int>(drag_data_->size()));
164 DCHECK(to <= static_cast<int>(drag_data_->size())); 165 DCHECK(to <= static_cast<int>(drag_data_->size()));
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 363 }
363 364
364 cairo_destroy(cairo_context); 365 cairo_destroy(cairo_context);
365 366
366 // Set the shape mask. 367 // Set the shape mask.
367 gdk_window_shape_combine_mask(container_->window, pixmap, 0, 0); 368 gdk_window_shape_combine_mask(container_->window, pixmap, 0, 0);
368 g_object_unref(pixmap); 369 g_object_unref(pixmap);
369 } 370 }
370 371
371 gboolean DraggedViewGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) { 372 gboolean DraggedViewGtk::OnExpose(GtkWidget* widget, GdkEventExpose* event) {
372 if (gtk_util::IsScreenComposited()) 373 if (ui::IsScreenComposited())
373 SetContainerTransparency(); 374 SetContainerTransparency();
374 else 375 else
375 SetContainerShapeMask(); 376 SetContainerShapeMask();
376 377
377 // Only used when not attached. 378 // Only used when not attached.
378 int tab_height = static_cast<int>( 379 int tab_height = static_cast<int>(
379 kScalingFactor * renderers_[drag_data_->source_tab_index()]->height()); 380 kScalingFactor * renderers_[drag_data_->source_tab_index()]->height());
380 381
381 // Draw the render area. 382 // Draw the render area.
382 BackingStore* backing_store = drag_data_->GetSourceTabContents()-> 383 BackingStore* backing_store = drag_data_->GetSourceTabContents()->
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 if (!attached_) { 446 if (!attached_) {
446 paint_at = widget_width / kScalingFactor - 447 paint_at = widget_width / kScalingFactor -
447 GetWidthInTabStripFromTo(0, index + 1); 448 GetWidthInTabStripFromTo(0, index + 1);
448 } 449 }
449 } 450 }
450 451
451 cairo_set_source_surface(cr, surface, paint_at, 0); 452 cairo_set_source_surface(cr, surface, paint_at, 0);
452 cairo_paint(cr); 453 cairo_paint(cr);
453 cairo_surface_destroy(surface); 454 cairo_surface_destroy(surface);
454 } 455 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/tab_contents_drag_source.cc ('k') | chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698