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

Side by Side Diff: chrome/browser/views/tabs/tab_overview_controller.cc

Issue 144006: Add Linux support for getting the thumbnail and wire into the switcher. (Closed)
Patch Set: For checkin Created 11 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
« no previous file with comments | « chrome/browser/views/tabs/tab_overview_cell.cc ('k') | views/controls/image_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/tabs/tab_overview_controller.h" 5 #include "chrome/browser/views/tabs/tab_overview_controller.h"
6 6
7 #include "chrome/browser/browser.h" 7 #include "chrome/browser/browser.h"
8 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/gtk/browser_window_gtk.h" 9 #include "chrome/browser/gtk/browser_window_gtk.h"
9 #include "chrome/browser/tab_contents/tab_contents.h" 10 #include "chrome/browser/tab_contents/tab_contents.h"
11 #include "chrome/browser/tab_contents/thumbnail_generator.h"
10 #include "chrome/browser/views/tabs/tab_overview_cell.h" 12 #include "chrome/browser/views/tabs/tab_overview_cell.h"
11 #include "chrome/browser/views/tabs/tab_overview_container.h" 13 #include "chrome/browser/views/tabs/tab_overview_container.h"
12 #include "chrome/browser/views/tabs/tab_overview_grid.h" 14 #include "chrome/browser/views/tabs/tab_overview_grid.h"
13 #include "chrome/browser/views/tabs/tab_overview_types.h" 15 #include "chrome/browser/views/tabs/tab_overview_types.h"
14 #include "chrome/browser/window_sizer.h" 16 #include "chrome/browser/window_sizer.h"
15 #include "views/widget/root_view.h" 17 #include "views/widget/root_view.h"
16 #include "views/widget/widget_gtk.h" 18 #include "views/widget/widget_gtk.h"
17 19
18 // Horizontal padding from the edge of the monitor to the overview. 20 // Horizontal padding from the edge of the monitor to the overview.
19 static int kMonitorPadding = 20; 21 static int kMonitorPadding = 20;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (host_->IsVisible()) 102 if (host_->IsVisible())
101 return; 103 return;
102 104
103 shown_ = true; 105 shown_ = true;
104 DCHECK(model()); // The model needs to be set before showing. 106 DCHECK(model()); // The model needs to be set before showing.
105 host_->Show(); 107 host_->Show();
106 } 108 }
107 109
108 void TabOverviewController::ConfigureCell(TabOverviewCell* cell, 110 void TabOverviewController::ConfigureCell(TabOverviewCell* cell,
109 TabContents* contents) { 111 TabContents* contents) {
110 // TODO: need to set thumbnail here.
111 if (contents) { 112 if (contents) {
112 cell->SetTitle(contents->GetTitle()); 113 cell->SetTitle(contents->GetTitle());
113 cell->SetFavIcon(contents->GetFavIcon()); 114 cell->SetFavIcon(contents->GetFavIcon());
115
116 ThumbnailGenerator* generator = g_browser_process->GetThumbnailGenerator();
117 cell->SetThumbnail(
118 generator->GetThumbnailForRenderer(contents->render_view_host()));
119
114 cell->SchedulePaint(); 120 cell->SchedulePaint();
115 } else { 121 } else {
116 // Need to figure out under what circumstances this is null and deal. 122 // Need to figure out under what circumstances this is null and deal.
117 NOTIMPLEMENTED(); 123 NOTIMPLEMENTED();
118 } 124 }
119 } 125 }
120 126
121 void TabOverviewController::DragStarted() { 127 void TabOverviewController::DragStarted() {
122 DCHECK(!drag_browser_); 128 DCHECK(!drag_browser_);
123 drag_browser_ = browser_; 129 drag_browser_ = browser_;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 gfx::Rect TabOverviewController::CalculateHostBounds() { 290 gfx::Rect TabOverviewController::CalculateHostBounds() {
285 int max_width = monitor_bounds_.width() - kMonitorPadding * 2; 291 int max_width = monitor_bounds_.width() - kMonitorPadding * 2;
286 int window_height = monitor_bounds_.height() * kWindowHeight; 292 int window_height = monitor_bounds_.height() * kWindowHeight;
287 int max_height = static_cast<int>(monitor_bounds_.height() * 293 int max_height = static_cast<int>(monitor_bounds_.height() *
288 kOverviewHeight); 294 kOverviewHeight);
289 return gfx::Rect(monitor_bounds_.x() + kMonitorPadding, 295 return gfx::Rect(monitor_bounds_.x() + kMonitorPadding,
290 monitor_bounds_.bottom() - window_height - 296 monitor_bounds_.bottom() - window_height -
291 kWindowToOverviewPadding - max_height, max_width, 297 kWindowToOverviewPadding - max_height, max_width,
292 max_height); 298 max_height);
293 } 299 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_overview_cell.cc ('k') | views/controls/image_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698