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

Side by Side Diff: chrome/browser/gtk/download_item_gtk.h

Issue 113920: Dangerous download dialog for linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: mac uses DownloadManager? Created 11 years, 7 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
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_
6 #define CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ 6 #define CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "app/animation.h" 10 #include "app/animation.h"
(...skipping 26 matching lines...) Expand all
37 // AnimationDelegate implementation. 37 // AnimationDelegate implementation.
38 virtual void AnimationProgressed(const Animation* animation); 38 virtual void AnimationProgressed(const Animation* animation);
39 39
40 // Called when the icon manager has finished loading the icon. We take 40 // Called when the icon manager has finished loading the icon. We take
41 // ownership of |icon_bitmap|. 41 // ownership of |icon_bitmap|.
42 void OnLoadIconComplete(IconManager::Handle handle, SkBitmap* icon_bitmap); 42 void OnLoadIconComplete(IconManager::Handle handle, SkBitmap* icon_bitmap);
43 43
44 private: 44 private:
45 friend class DownloadShelfContextMenuGtk; 45 friend class DownloadShelfContextMenuGtk;
46 46
47 DownloadItem* get_download();
48
49 // Returns true IFF the download is dangerous and unconfirmed.
50 bool IsDangerous();
51
47 // Functions for controlling the progress animation. 52 // Functions for controlling the progress animation.
48 // Repaint the download progress. 53 // Repaint the download progress.
49 void UpdateDownloadProgress(); 54 void UpdateDownloadProgress();
50 55
51 // Starts a repeating timer for UpdateDownloadProgress. 56 // Starts a repeating timer for UpdateDownloadProgress.
52 void StartDownloadProgress(); 57 void StartDownloadProgress();
53 58
54 // Stops the repeating timer. 59 // Stops the repeating timer.
55 void StopDownloadProgress(); 60 void StopDownloadProgress();
56 61
(...skipping 12 matching lines...) Expand all
69 DownloadItemGtk* download_item); 74 DownloadItemGtk* download_item);
70 75
71 static gboolean OnMenuButtonPressEvent(GtkWidget* button, 76 static gboolean OnMenuButtonPressEvent(GtkWidget* button,
72 GdkEvent* event, 77 GdkEvent* event,
73 DownloadItemGtk* item); 78 DownloadItemGtk* item);
74 79
75 static void OnShelfResized(GtkWidget *widget, 80 static void OnShelfResized(GtkWidget *widget,
76 GtkAllocation *allocation, 81 GtkAllocation *allocation,
77 DownloadItemGtk* item); 82 DownloadItemGtk* item);
78 83
84 // Dangerous download related. -----------------------------------------------
85 static gboolean OnDangerousPromptExpose(GtkWidget* widget,
86 GdkEventExpose* event,
87 DownloadItemGtk* item);
88
89 static void OnDangerousAccept(GtkWidget* button, DownloadItemGtk* item);
90 static void OnDangerousDecline(GtkWidget* button, DownloadItemGtk* item);
91
79 // Nineboxes for the body area. 92 // Nineboxes for the body area.
80 static NineBox* body_nine_box_normal_; 93 static NineBox* body_nine_box_normal_;
81 static NineBox* body_nine_box_prelight_; 94 static NineBox* body_nine_box_prelight_;
82 static NineBox* body_nine_box_active_; 95 static NineBox* body_nine_box_active_;
83 96
84 // Nineboxes for the menu button. 97 // Nineboxes for the menu button.
85 static NineBox* menu_nine_box_normal_; 98 static NineBox* menu_nine_box_normal_;
86 static NineBox* menu_nine_box_prelight_; 99 static NineBox* menu_nine_box_prelight_;
87 static NineBox* menu_nine_box_active_; 100 static NineBox* menu_nine_box_active_;
88 101
102 // Ninebox for the background of the dangerous download prompt.
103 static NineBox* dangerous_nine_box_;
104
89 // The shelf on which we are displayed. 105 // The shelf on which we are displayed.
90 DownloadShelfGtk* parent_shelf_; 106 DownloadShelfGtk* parent_shelf_;
91 107
92 // The widget that contains the body and menu dropdown. 108 // The widget that contains the body and menu dropdown.
93 GtkWidget* hbox_; 109 GtkWidget* hbox_;
94 110
95 // The widget that contains the name of the download and the progress 111 // The widget that contains the name of the download and the progress
96 // animation. 112 // animation.
97 GtkWidget* body_; 113 GtkWidget* body_;
98 114
(...skipping 21 matching lines...) Expand all
120 // create this until the first time we actually need it. 136 // create this until the first time we actually need it.
121 scoped_ptr<DownloadShelfContextMenuGtk> menu_; 137 scoped_ptr<DownloadShelfContextMenuGtk> menu_;
122 138
123 // The download item model we represent. 139 // The download item model we represent.
124 scoped_ptr<BaseDownloadItemModel> download_model_; 140 scoped_ptr<BaseDownloadItemModel> download_model_;
125 141
126 // This is the leftmost widget on |parent_shelf_| that is not a download item. 142 // This is the leftmost widget on |parent_shelf_| that is not a download item.
127 // We do not want to overlap it. 143 // We do not want to overlap it.
128 GtkWidget* bounding_widget_; 144 GtkWidget* bounding_widget_;
129 145
146 // The dangerous download dialog. This will be null for safe downloads.
147 GtkWidget* dangerous_prompt_;
148
149 // An hbox for holding components of the dangerous download dialog.
150 GtkWidget* dangerous_hbox_;
151 int dangerous_hbox_full_width_;
152
130 // The ID of the handler for the parent shelf's "size-allocate" event. We save 153 // The ID of the handler for the parent shelf's "size-allocate" event. We save
131 // it so we can disconnect when we are destroyed. 154 // it so we can disconnect when we are destroyed.
132 gulong resize_handler_id_; 155 gulong resize_handler_id_;
133 156
134 // The animation when this item is first added to the shelf. 157 // The animation when this item is first added to the shelf.
135 scoped_ptr<SlideAnimation> new_item_animation_; 158 scoped_ptr<SlideAnimation> new_item_animation_;
136 159
137 // Progress animation. 160 // Progress animation.
138 base::RepeatingTimer<DownloadItemGtk> progress_timer_; 161 base::RepeatingTimer<DownloadItemGtk> progress_timer_;
139 162
140 // Animation for download complete. 163 // Animation for download complete.
141 scoped_ptr<SlideAnimation> complete_animation_; 164 scoped_ptr<SlideAnimation> complete_animation_;
142 165
143 // The file icon for the download. May be null. 166 // The file icon for the download. May be null.
144 SkBitmap* icon_; 167 SkBitmap* icon_;
145 168
146 // For canceling an in progress icon request. 169 // For canceling an in progress icon request.
147 CancelableRequestConsumerT<int, 0> icon_consumer_; 170 CancelableRequestConsumerT<int, 0> icon_consumer_;
148 }; 171 };
149 172
150 #endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_ 173 #endif // CHROME_BROWSER_GTK_DOWNLOAD_ITEM_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_util.h ('k') | chrome/browser/gtk/download_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698