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 #ifndef CHROME_BROWSER_COMMAND_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_COMMAND_UPDATER_H_ |
6 #define CHROME_BROWSER_COMMAND_UPDATER_H_ | 6 #define CHROME_BROWSER_COMMAND_UPDATER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "ui/base/window_open_disposition.h" | 10 #include "ui/base/window_open_disposition.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // Removes |observer| for all commands on which it's registered. | 56 // Removes |observer| for all commands on which it's registered. |
57 void RemoveCommandObserver(CommandObserver* observer); | 57 void RemoveCommandObserver(CommandObserver* observer); |
58 | 58 |
59 // Notify all observers of a particular command that the command has been | 59 // Notify all observers of a particular command that the command has been |
60 // enabled or disabled. If the command does not exist, it is created and | 60 // enabled or disabled. If the command does not exist, it is created and |
61 // initialized to |state|. This function is very lightweight if the command | 61 // initialized to |state|. This function is very lightweight if the command |
62 // state has not changed. | 62 // state has not changed. |
63 void UpdateCommandEnabled(int id, bool state); | 63 void UpdateCommandEnabled(int id, bool state); |
64 | 64 |
| 65 // Set status for bookmark icon selection. |
| 66 void set_bookmark_icon_selected(bool selection) { |
| 67 bookmark_icon_selection_ = selection; |
| 68 } |
| 69 |
| 70 // Returns the status of bookmark icon selection. |
| 71 bool get_bookmark_icon_selected() { return bookmark_icon_selection_; } |
| 72 |
65 private: | 73 private: |
66 // A piece of data about a command - whether or not it is enabled, and a list | 74 // A piece of data about a command - whether or not it is enabled, and a list |
67 // of objects that observe the enabled state of this command. | 75 // of objects that observe the enabled state of this command. |
68 class Command; | 76 class Command; |
69 | 77 |
70 // Get a Command node for a given command ID, creating an entry if it doesn't | 78 // Get a Command node for a given command ID, creating an entry if it doesn't |
71 // exist if desired. | 79 // exist if desired. |
72 Command* GetCommand(int id, bool create); | 80 Command* GetCommand(int id, bool create); |
73 | 81 |
74 // The delegate is responsible for executing commands. | 82 // The delegate is responsible for executing commands. |
75 CommandUpdaterDelegate* delegate_; | 83 CommandUpdaterDelegate* delegate_; |
76 | 84 |
77 // This is a map of command IDs to states and observer lists | 85 // This is a map of command IDs to states and observer lists |
78 typedef base::hash_map<int, Command*> CommandMap; | 86 typedef base::hash_map<int, Command*> CommandMap; |
79 CommandMap commands_; | 87 CommandMap commands_; |
80 | 88 |
| 89 // Keep status of bookmark icon selection. |
| 90 bool bookmark_icon_selection_; |
| 91 |
81 DISALLOW_COPY_AND_ASSIGN(CommandUpdater); | 92 DISALLOW_COPY_AND_ASSIGN(CommandUpdater); |
82 }; | 93 }; |
83 | 94 |
84 #endif // CHROME_BROWSER_COMMAND_UPDATER_H_ | 95 #endif // CHROME_BROWSER_COMMAND_UPDATER_H_ |
OLD | NEW |