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/views/download/download_shelf_view.h" | 5 #include "chrome/browser/ui/views/download/download_shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/download/download_item_model.h" | 12 #include "chrome/browser/download/download_item_model.h" |
13 #include "chrome/browser/download/download_util.h" | 13 #include "chrome/browser/download/download_util.h" |
14 #include "chrome/browser/themes/theme_service.h" | 14 #include "chrome/browser/themes/theme_service.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/view_ids.h" | 16 #include "chrome/browser/ui/view_ids.h" |
17 #include "chrome/browser/ui/views/download/download_item_view.h" | 17 #include "chrome/browser/ui/views/download/download_item_view.h" |
18 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
19 #include "content/public/browser/download_item.h" | 19 #include "content/public/browser/download_item.h" |
20 #include "content/public/browser/download_manager.h" | 20 #include "content/public/browser/download_manager.h" |
| 21 #include "content/public/browser/page_navigator.h" |
21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
23 #include "grit/theme_resources_standard.h" | 24 #include "grit/theme_resources_standard.h" |
24 #include "grit/ui_resources_standard.h" | 25 #include "grit/ui_resources_standard.h" |
25 #include "ui/base/animation/slide_animation.h" | 26 #include "ui/base/animation/slide_animation.h" |
26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
28 #include "ui/gfx/canvas.h" | 29 #include "ui/gfx/canvas.h" |
29 #include "ui/views/background.h" | 30 #include "ui/views/background.h" |
30 #include "ui/views/controls/button/image_button.h" | 31 #include "ui/views/controls/button/image_button.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 179 |
179 void DownloadShelfView::OnPaintBorder(gfx::Canvas* canvas) { | 180 void DownloadShelfView::OnPaintBorder(gfx::Canvas* canvas) { |
180 canvas->FillRect(gfx::Rect(0, 0, width(), 1), kBorderColor); | 181 canvas->FillRect(gfx::Rect(0, 0, width(), 1), kBorderColor); |
181 } | 182 } |
182 | 183 |
183 void DownloadShelfView::OpenedDownload(DownloadItemView* view) { | 184 void DownloadShelfView::OpenedDownload(DownloadItemView* view) { |
184 if (CanAutoClose()) | 185 if (CanAutoClose()) |
185 mouse_watcher_.Start(); | 186 mouse_watcher_.Start(); |
186 } | 187 } |
187 | 188 |
| 189 content::PageNavigator* DownloadShelfView::GetNavigator() { |
| 190 return browser_; |
| 191 } |
| 192 |
188 gfx::Size DownloadShelfView::GetPreferredSize() { | 193 gfx::Size DownloadShelfView::GetPreferredSize() { |
189 gfx::Size prefsize(kRightPadding + kLeftPadding + kCloseAndLinkPadding, 0); | 194 gfx::Size prefsize(kRightPadding + kLeftPadding + kCloseAndLinkPadding, 0); |
190 AdjustSize(close_button_, &prefsize); | 195 AdjustSize(close_button_, &prefsize); |
191 AdjustSize(show_all_view_, &prefsize); | 196 AdjustSize(show_all_view_, &prefsize); |
192 // Add one download view to the preferred size. | 197 // Add one download view to the preferred size. |
193 if (!download_views_.empty()) { | 198 if (!download_views_.empty()) { |
194 AdjustSize(*download_views_.begin(), &prefsize); | 199 AdjustSize(*download_views_.begin(), &prefsize); |
195 prefsize.Enlarge(kDownloadPadding, 0); | 200 prefsize.Enlarge(kDownloadPadding, 0); |
196 } | 201 } |
197 prefsize.Enlarge(0, kTopBottomPadding + kTopBottomPadding); | 202 prefsize.Enlarge(0, kTopBottomPadding + kTopBottomPadding); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 const DownloadItemView* download_item_view) { | 474 const DownloadItemView* download_item_view) { |
470 gfx::Rect bounds = download_item_view->bounds(); | 475 gfx::Rect bounds = download_item_view->bounds(); |
471 | 476 |
472 #if defined(TOOLKIT_VIEWS) | 477 #if defined(TOOLKIT_VIEWS) |
473 bounds.set_height(bounds.height() - 1); | 478 bounds.set_height(bounds.height() - 1); |
474 bounds.Offset(0, 3); | 479 bounds.Offset(0, 3); |
475 #endif | 480 #endif |
476 | 481 |
477 return bounds; | 482 return bounds; |
478 } | 483 } |
OLD | NEW |