OLD | NEW |
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/download/download_shelf_gtk.h" | 5 #include "chrome/browser/ui/gtk/download/download_shelf_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 void DownloadShelfGtk::Show() { | 189 void DownloadShelfGtk::Show() { |
190 slide_widget_->Open(); | 190 slide_widget_->Open(); |
191 browser_->UpdateDownloadShelfVisibility(true); | 191 browser_->UpdateDownloadShelfVisibility(true); |
192 CancelAutoClose(); | 192 CancelAutoClose(); |
193 } | 193 } |
194 | 194 |
195 void DownloadShelfGtk::Close() { | 195 void DownloadShelfGtk::Close() { |
196 // When we are closing, we can vertically overlap the render view. Make sure | 196 // When we are closing, we can vertically overlap the render view. Make sure |
197 // we are on top. | 197 // we are on top. |
198 gdk_window_raise(shelf_.get()->window); | 198 gdk_window_raise(gtk_widget_get_window(shelf_.get())); |
199 slide_widget_->Close(); | 199 slide_widget_->Close(); |
200 browser_->UpdateDownloadShelfVisibility(false); | 200 browser_->UpdateDownloadShelfVisibility(false); |
201 int num_in_progress = 0; | 201 int num_in_progress = 0; |
202 for (size_t i = 0; i < download_items_.size(); ++i) { | 202 for (size_t i = 0; i < download_items_.size(); ++i) { |
203 if (download_items_[i]->get_download()->IsInProgress()) | 203 if (download_items_[i]->get_download()->IsInProgress()) |
204 ++num_in_progress; | 204 ++num_in_progress; |
205 } | 205 } |
206 download_stats::RecordShelfClose( | 206 download_stats::RecordShelfClose( |
207 download_items_.size(), num_in_progress, close_on_mouse_out_); | 207 download_items_.size(), num_in_progress, close_on_mouse_out_); |
208 SetCloseOnMouseOut(false); | 208 SetCloseOnMouseOut(false); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
385 MessageLoop::current()->PostDelayedTask( | 385 MessageLoop::current()->PostDelayedTask( |
386 FROM_HERE, | 386 FROM_HERE, |
387 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()), | 387 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()), |
388 kAutoCloseDelayMs); | 388 kAutoCloseDelayMs); |
389 } | 389 } |
390 | 390 |
391 void DownloadShelfGtk::MouseEnteredShelf() { | 391 void DownloadShelfGtk::MouseEnteredShelf() { |
392 weak_factory_.InvalidateWeakPtrs(); | 392 weak_factory_.InvalidateWeakPtrs(); |
393 } | 393 } |
OLD | NEW |