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

Side by Side Diff: chrome/browser/ui/gtk/download/download_shelf_gtk.cc

Issue 8008021: Add new UMA stats to get a handle on Downloads UI Usage (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: merge Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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"
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/browser/download/download_item.h" 21 #include "content/browser/download/download_item.h"
22 #include "content/browser/download/download_stats.h"
22 #include "content/common/notification_service.h" 23 #include "content/common/notification_service.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 "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/gtk_util.h" 29 #include "ui/gfx/gtk_util.h"
29 #include "ui/gfx/image/image.h" 30 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/insets.h" 31 #include "ui/gfx/insets.h"
31 #include "ui/gfx/point.h" 32 #include "ui/gfx/point.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 browser_->UpdateDownloadShelfVisibility(true); 189 browser_->UpdateDownloadShelfVisibility(true);
189 CancelAutoClose(); 190 CancelAutoClose();
190 } 191 }
191 192
192 void DownloadShelfGtk::Close() { 193 void DownloadShelfGtk::Close() {
193 // When we are closing, we can vertically overlap the render view. Make sure 194 // When we are closing, we can vertically overlap the render view. Make sure
194 // we are on top. 195 // we are on top.
195 gdk_window_raise(shelf_.get()->window); 196 gdk_window_raise(shelf_.get()->window);
196 slide_widget_->Close(); 197 slide_widget_->Close();
197 browser_->UpdateDownloadShelfVisibility(false); 198 browser_->UpdateDownloadShelfVisibility(false);
199 int num_in_progress = 0;
200 for (size_t i = 0; i < download_items_.size(); ++i) {
201 if (download_items_[i]->get_download()->IsInProgress())
202 ++num_in_progress;
203 }
204 download_stats::RecordShelfClose(
205 download_items_.size(), num_in_progress, close_on_mouse_out_);
198 SetCloseOnMouseOut(false); 206 SetCloseOnMouseOut(false);
199 } 207 }
200 208
201 Browser* DownloadShelfGtk::browser() const { 209 Browser* DownloadShelfGtk::browser() const {
202 return browser_; 210 return browser_;
203 } 211 }
204 212
205 void DownloadShelfGtk::Closed() { 213 void DownloadShelfGtk::Closed() {
206 // When the close animation is complete, remove all completed downloads. 214 // When the close animation is complete, remove all completed downloads.
207 size_t i = 0; 215 size_t i = 0;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 378
371 MessageLoop::current()->PostDelayedTask( 379 MessageLoop::current()->PostDelayedTask(
372 FROM_HERE, 380 FROM_HERE,
373 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()), 381 base::Bind(&DownloadShelfGtk::Close, weak_factory_.GetWeakPtr()),
374 kAutoCloseDelayMs); 382 kAutoCloseDelayMs);
375 } 383 }
376 384
377 void DownloadShelfGtk::MouseEnteredShelf() { 385 void DownloadShelfGtk::MouseEnteredShelf() {
378 weak_factory_.InvalidateWeakPtrs(); 386 weak_factory_.InvalidateWeakPtrs();
379 } 387 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_shelf_controller.mm ('k') | chrome/browser/ui/views/download/download_shelf_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698