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

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

Issue 10545115: TabContentsWrapper -> TabContents, part 41. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/debug/trace_event.h" 11 #include "base/debug/trace_event.h"
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "chrome/browser/extensions/extension_tab_helper.h" 14 #include "chrome/browser/extensions/extension_tab_helper.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.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_theme_service.h" 18 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
19 #include "chrome/browser/ui/gtk/gtk_util.h" 19 #include "chrome/browser/ui/gtk/gtk_util.h"
20 #include "chrome/browser/ui/gtk/tabs/drag_data.h" 20 #include "chrome/browser/ui/gtk/tabs/drag_data.h"
21 #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h" 21 #include "chrome/browser/ui/gtk/tabs/tab_renderer_gtk.h"
22 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 22 #include "chrome/browser/ui/tab_contents/tab_contents.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" 23 #include "chrome/browser/ui/tabs/tab_strip_model.h"
24 #include "content/public/browser/render_view_host.h" 24 #include "content/public/browser/render_view_host.h"
25 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
26 #include "third_party/skia/include/core/SkShader.h" 26 #include "third_party/skia/include/core/SkShader.h"
27 #include "ui/base/gtk/gtk_screen_util.h" 27 #include "ui/base/gtk/gtk_screen_util.h"
28 #include "ui/base/x/x11_util.h" 28 #include "ui/base/x/x11_util.h"
29 #include "ui/gfx/gtk_util.h" 29 #include "ui/gfx/gtk_util.h"
30 30
31 using content::WebContents; 31 using content::WebContents;
32 32
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 attached_tab_size_(TabRendererGtk::GetMinimumSelectedSize()), 64 attached_tab_size_(TabRendererGtk::GetMinimumSelectedSize()),
65 contents_size_(contents_size), 65 contents_size_(contents_size),
66 close_animation_(this) { 66 close_animation_(this) {
67 std::vector<WebContents*> data_sources(drag_data_->GetDraggedTabsContents()); 67 std::vector<WebContents*> data_sources(drag_data_->GetDraggedTabsContents());
68 for (size_t i = 0; i < data_sources.size(); i++) { 68 for (size_t i = 0; i < data_sources.size(); i++) {
69 renderers_.push_back(new TabRendererGtk(GtkThemeService::GetFrom( 69 renderers_.push_back(new TabRendererGtk(GtkThemeService::GetFrom(
70 Profile::FromBrowserContext(data_sources[i]->GetBrowserContext())))); 70 Profile::FromBrowserContext(data_sources[i]->GetBrowserContext()))));
71 } 71 }
72 72
73 for (size_t i = 0; i < drag_data_->size(); i++) { 73 for (size_t i = 0; i < drag_data_->size(); i++) {
74 TabContentsWrapper* wrapper = 74 TabContents* tab_contents = TabContents::FromWebContents(
75 TabContentsWrapper::GetCurrentWrapperForContents( 75 drag_data_->get(i)->contents_->web_contents());
76 drag_data_->get(i)->contents_->web_contents());
77 renderers_[i]->UpdateData( 76 renderers_[i]->UpdateData(
78 drag_data_->get(i)->contents_->web_contents(), 77 drag_data_->get(i)->contents_->web_contents(),
79 wrapper->extension_tab_helper()->is_app(), 78 tab_contents->extension_tab_helper()->is_app(),
80 false); // loading_only 79 false); // loading_only
81 renderers_[i]->set_is_active( 80 renderers_[i]->set_is_active(
82 static_cast<int>(i) == drag_data_->source_tab_index()); 81 static_cast<int>(i) == drag_data_->source_tab_index());
83 } 82 }
84 83
85 container_ = gtk_window_new(GTK_WINDOW_POPUP); 84 container_ = gtk_window_new(GTK_WINDOW_POPUP);
86 SetContainerColorMap(); 85 SetContainerColorMap();
87 gtk_widget_set_app_paintable(container_, TRUE); 86 gtk_widget_set_app_paintable(container_, TRUE);
88 g_signal_connect(container_, "expose-event", G_CALLBACK(OnExposeThunk), this); 87 g_signal_connect(container_, "expose-event", G_CALLBACK(OnExposeThunk), this);
89 gtk_widget_add_events(container_, GDK_STRUCTURE_MASK); 88 gtk_widget_add_events(container_, GDK_STRUCTURE_MASK);
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 if (!attached_) { 466 if (!attached_) {
468 paint_at = widget_width / kScalingFactor - 467 paint_at = widget_width / kScalingFactor -
469 GetWidthInTabStripFromTo(0, index + 1); 468 GetWidthInTabStripFromTo(0, index + 1);
470 } 469 }
471 } 470 }
472 471
473 cairo_set_source_surface(cr, surface, paint_at, 0); 472 cairo_set_source_surface(cr, surface, paint_at, 0);
474 cairo_paint(cr); 473 cairo_paint(cr);
475 cairo_surface_destroy(surface); 474 cairo_surface_destroy(surface);
476 } 475 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/tabs/dragged_view_gtk.h ('k') | chrome/browser/ui/gtk/tabs/tab_renderer_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698