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

Side by Side Diff: chrome/browser/download/download_shelf_context_menu.h

Issue 8757007: Implement additional UI changes for dangerous download warnings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years 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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "ui/base/models/simple_menu_model.h" 13 #include "ui/base/models/simple_menu_model.h"
14 14
15 class BaseDownloadItemModel; 15 class BaseDownloadItemModel;
16 class DownloadItem; 16 class DownloadItem;
17 17
18 // This class is responsible for the download shelf context menu. Platform 18 // This class is responsible for the download shelf context menu. Platform
19 // specific subclasses are responsible for creating and running the menu. 19 // specific subclasses are responsible for creating and running the menu.
20 class DownloadShelfContextMenu : public ui::SimpleMenuModel::Delegate { 20 class DownloadShelfContextMenu : public ui::SimpleMenuModel::Delegate {
21 public: 21 public:
22 enum ContextMenuCommands { 22 enum ContextMenuCommands {
23 SHOW_IN_FOLDER = 1, // Open a file explorer window with the item selected. 23 SHOW_IN_FOLDER = 1, // Open a file explorer window with the item selected.
24 OPEN_WHEN_COMPLETE, // Open the download when it's finished. 24 OPEN_WHEN_COMPLETE, // Open the download when it's finished.
25 ALWAYS_OPEN_TYPE, // Default this file extension to always open. 25 ALWAYS_OPEN_TYPE, // Default this file extension to always open.
26 CANCEL, // Cancel the download. 26 CANCEL, // Cancel the download.
27 TOGGLE_PAUSE, // Temporarily pause a download. 27 TOGGLE_PAUSE, // Temporarily pause a download.
28 DISCARD, // Discard the malicious download.
29 KEEP, // Keep the malicious download.
30 LEARN_MORE, // Show information about download scanning.
28 MENU_LAST 31 MENU_LAST
29 }; 32 };
30 33
31 virtual ~DownloadShelfContextMenu(); 34 virtual ~DownloadShelfContextMenu();
32 35
33 DownloadItem* download_item() const { return download_item_; } 36 DownloadItem* download_item() const { return download_item_; }
34 void set_download_item(DownloadItem* item) { download_item_ = item; } 37 void set_download_item(DownloadItem* item) { download_item_ = item; }
35 38
36 protected: 39 protected:
37 explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model); 40 explicit DownloadShelfContextMenu(BaseDownloadItemModel* download_model);
38 41
39 // Returns the correct menu model depending whether the download item is 42 // Returns the correct menu model depending whether the download item is
40 // completed or not. 43 // completed or not.
41 ui::SimpleMenuModel* GetMenuModel(); 44 ui::SimpleMenuModel* GetMenuModel();
42 45
43 // ui::SimpleMenuModel::Delegate: 46 // ui::SimpleMenuModel::Delegate:
44 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 47 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
45 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 48 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
46 virtual void ExecuteCommand(int command_id) OVERRIDE; 49 virtual void ExecuteCommand(int command_id) OVERRIDE;
47 virtual bool GetAcceleratorForCommandId( 50 virtual bool GetAcceleratorForCommandId(
48 int command_id, 51 int command_id,
49 ui::Accelerator* accelerator) OVERRIDE; 52 ui::Accelerator* accelerator) OVERRIDE;
50 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; 53 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE;
51 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; 54 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE;
52 55
53 private: 56 private:
54 ui::SimpleMenuModel* GetInProgressMenuModel(); 57 ui::SimpleMenuModel* GetInProgressMenuModel();
55 ui::SimpleMenuModel* GetFinishedMenuModel(); 58 ui::SimpleMenuModel* GetFinishedMenuModel();
59 ui::SimpleMenuModel* GetMaliciousMenuModel();
56 60
57 // We show slightly different menus if the download is in progress vs. if the 61 // We show slightly different menus if the download is in progress vs. if the
58 // download has finished. 62 // download has finished.
59 scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_; 63 scoped_ptr<ui::SimpleMenuModel> in_progress_download_menu_model_;
60 scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_; 64 scoped_ptr<ui::SimpleMenuModel> finished_download_menu_model_;
65 scoped_ptr<ui::SimpleMenuModel> malicious_download_menu_model_;
61 66
62 // A model to control the cancel behavior. 67 // A model to control the cancel behavior.
63 BaseDownloadItemModel* download_model_; 68 BaseDownloadItemModel* download_model_;
64 69
65 // Information source. 70 // Information source.
66 DownloadItem* download_item_; 71 DownloadItem* download_item_;
67 72
68 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu); 73 DISALLOW_COPY_AND_ASSIGN(DownloadShelfContextMenu);
69 }; 74 };
70 75
71 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_ 76 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/download/download_shelf_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698