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 "chrome/browser/download/download_item.h" | 9 #include "chrome/browser/download/download_item.h" |
10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| 11 #include "chrome/browser/download/download_manager.h" |
11 #include "chrome/browser/download/download_util.h" | 12 #include "chrome/browser/download/download_util.h" |
| 13 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 15 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
14 #include "chrome/browser/ui/gtk/custom_button.h" | 16 #include "chrome/browser/ui/gtk/custom_button.h" |
15 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" | 17 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" |
16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 18 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
17 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" | 19 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" |
18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 20 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
19 #include "chrome/browser/ui/gtk/gtk_util.h" | 21 #include "chrome/browser/ui/gtk/gtk_util.h" |
20 #include "content/common/notification_service.h" | 22 #include "content/common/notification_service.h" |
21 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 181 } |
180 | 182 |
181 bool DownloadShelfGtk::IsClosing() const { | 183 bool DownloadShelfGtk::IsClosing() const { |
182 return slide_widget_->IsClosing(); | 184 return slide_widget_->IsClosing(); |
183 } | 185 } |
184 | 186 |
185 void DownloadShelfGtk::Show() { | 187 void DownloadShelfGtk::Show() { |
186 slide_widget_->Open(); | 188 slide_widget_->Open(); |
187 browser_->UpdateDownloadShelfVisibility(true); | 189 browser_->UpdateDownloadShelfVisibility(true); |
188 CancelAutoClose(); | 190 CancelAutoClose(); |
| 191 |
| 192 if (browser_->profile()->HasCreatedDownloadManager()) { |
| 193 DownloadManager* download_manager = |
| 194 browser_->profile()->GetDownloadManager(); |
| 195 download_manager->CheckForFilesRemoval(); |
| 196 } |
189 } | 197 } |
190 | 198 |
191 void DownloadShelfGtk::Close() { | 199 void DownloadShelfGtk::Close() { |
192 // When we are closing, we can vertically overlap the render view. Make sure | 200 // When we are closing, we can vertically overlap the render view. Make sure |
193 // we are on top. | 201 // we are on top. |
194 gdk_window_raise(shelf_.get()->window); | 202 gdk_window_raise(shelf_.get()->window); |
195 slide_widget_->Close(); | 203 slide_widget_->Close(); |
196 browser_->UpdateDownloadShelfVisibility(false); | 204 browser_->UpdateDownloadShelfVisibility(false); |
197 SetCloseOnMouseOut(false); | 205 SetCloseOnMouseOut(false); |
198 } | 206 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 | 381 |
374 MessageLoop::current()->PostDelayedTask( | 382 MessageLoop::current()->PostDelayedTask( |
375 FROM_HERE, | 383 FROM_HERE, |
376 auto_close_factory_.NewRunnableMethod(&DownloadShelfGtk::Close), | 384 auto_close_factory_.NewRunnableMethod(&DownloadShelfGtk::Close), |
377 kAutoCloseDelayMs); | 385 kAutoCloseDelayMs); |
378 } | 386 } |
379 | 387 |
380 void DownloadShelfGtk::MouseEnteredShelf() { | 388 void DownloadShelfGtk::MouseEnteredShelf() { |
381 auto_close_factory_.RevokeAll(); | 389 auto_close_factory_.RevokeAll(); |
382 } | 390 } |
OLD | NEW |