OLD | NEW |
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/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" |
11 #include "chrome/browser/download/download_util.h" | 11 #include "chrome/browser/download/download_util.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 13 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
14 #include "chrome/browser/ui/gtk/custom_button.h" | 14 #include "chrome/browser/ui/gtk/custom_button.h" |
15 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" | 15 #include "chrome/browser/ui/gtk/download/download_item_gtk.h" |
16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 16 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
17 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" | 17 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.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/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "content/public/browser/download_item.h" | 21 #include "content/public/browser/download_item.h" |
22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 23 #include "content/public/browser/page_navigator.h" |
23 #include "grit/generated_resources.h" | 24 #include "grit/generated_resources.h" |
24 #include "grit/theme_resources.h" | 25 #include "grit/theme_resources.h" |
25 #include "grit/theme_resources_standard.h" | 26 #include "grit/theme_resources_standard.h" |
26 #include "grit/ui_resources_standard.h" | 27 #include "grit/ui_resources_standard.h" |
27 #include "ui/base/gtk/gtk_screen_util.h" | 28 #include "ui/base/gtk/gtk_screen_util.h" |
28 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
30 #include "ui/gfx/gtk_util.h" | 31 #include "ui/gfx/gtk_util.h" |
31 #include "ui/gfx/image/image.h" | 32 #include "ui/gfx/image/image.h" |
32 #include "ui/gfx/insets.h" | 33 #include "ui/gfx/insets.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 delete *iter; | 167 delete *iter; |
167 } | 168 } |
168 | 169 |
169 shelf_.Destroy(); | 170 shelf_.Destroy(); |
170 items_hbox_.Destroy(); | 171 items_hbox_.Destroy(); |
171 | 172 |
172 // Make sure we're no longer an observer of the message loop. | 173 // Make sure we're no longer an observer of the message loop. |
173 SetCloseOnMouseOut(false); | 174 SetCloseOnMouseOut(false); |
174 } | 175 } |
175 | 176 |
| 177 content::PageNavigator* DownloadShelfGtk::GetNavigator() { |
| 178 return browser_; |
| 179 } |
| 180 |
176 void DownloadShelfGtk::DoAddDownload(BaseDownloadItemModel* download_model) { | 181 void DownloadShelfGtk::DoAddDownload(BaseDownloadItemModel* download_model) { |
177 download_items_.push_back(new DownloadItemGtk(this, download_model)); | 182 download_items_.push_back(new DownloadItemGtk(this, download_model)); |
178 } | 183 } |
179 | 184 |
180 bool DownloadShelfGtk::IsShowing() const { | 185 bool DownloadShelfGtk::IsShowing() const { |
181 return slide_widget_->IsShowing(); | 186 return slide_widget_->IsShowing(); |
182 } | 187 } |
183 | 188 |
184 bool DownloadShelfGtk::IsClosing() const { | 189 bool DownloadShelfGtk::IsClosing() const { |
185 return slide_widget_->IsClosing(); | 190 return slide_widget_->IsClosing(); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 | 392 |
388 MessageLoop::current()->PostDelayedTask( | 393 MessageLoop::current()->PostDelayedTask( |
389 FROM_HERE, | 394 FROM_HERE, |
390 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()), | 395 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()), |
391 base::TimeDelta::FromMilliseconds(kAutoCloseDelayMs)); | 396 base::TimeDelta::FromMilliseconds(kAutoCloseDelayMs)); |
392 } | 397 } |
393 | 398 |
394 void DownloadShelfGtk::MouseEnteredShelf() { | 399 void DownloadShelfGtk::MouseEnteredShelf() { |
395 weak_factory_.InvalidateWeakPtrs(); | 400 weak_factory_.InvalidateWeakPtrs(); |
396 } | 401 } |
OLD | NEW |