OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_WEB_INTENTS_SETTINGS_HANDLER_H_ | |
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_WEB_INTENTS_SETTINGS_HANDLER_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/ui/intents/web_intents_model.h" | |
11 #include "chrome/browser/ui/webui/options/options_ui.h" | |
12 | |
13 class WebIntentsRegistry; | |
14 | |
15 namespace options { | |
16 | |
17 // Manage setting up the backing data for the web intents options page. | |
18 class WebIntentsSettingsHandler : public OptionsPageUIHandler, | |
19 public WebIntentsModel::Observer { | |
20 public: | |
21 WebIntentsSettingsHandler(); | |
22 virtual ~WebIntentsSettingsHandler(); | |
23 | |
24 // OptionsPageUIHandler implementation. | |
25 virtual void GetLocalizedValues( | |
26 base::DictionaryValue* localized_strings) OVERRIDE; | |
27 virtual void RegisterMessages() OVERRIDE; | |
28 | |
29 // WebIntentsModel::Observer implementation. | |
30 virtual void TreeNodesAdded(ui::TreeModel* model, | |
31 ui::TreeModelNode* parent, | |
32 int start, | |
33 int count) OVERRIDE; | |
34 virtual void TreeNodesRemoved(ui::TreeModel* model, | |
35 ui::TreeModelNode* parent, | |
36 int start, | |
37 int count) OVERRIDE; | |
38 virtual void TreeNodeChanged(ui::TreeModel* model, | |
39 ui::TreeModelNode* node) OVERRIDE {} | |
40 virtual void TreeModelBeginBatch(WebIntentsModel* model) OVERRIDE; | |
41 virtual void TreeModelEndBatch(WebIntentsModel* model) OVERRIDE; | |
42 | |
43 private: | |
44 // Creates the WebIntentsModel if neccessary. | |
45 void EnsureWebIntentsModelCreated(); | |
46 | |
47 // Updates search filter for cookies tree model. | |
48 void UpdateSearchResults(const base::ListValue* args); | |
49 | |
50 // Remove all sites data. | |
51 void RemoveAll(const base::ListValue* args); | |
52 | |
53 // Remove selected sites data. | |
54 void RemoveIntent(const base::ListValue* args); | |
55 | |
56 // Helper functions for removals. | |
57 void RemoveOrigin(WebIntentsTreeNode* node); | |
58 void RemoveService(ServiceTreeNode* snode); | |
59 | |
60 // Trigger for SendChildren to load the JS model. | |
61 void LoadChildren(const base::ListValue* args); | |
62 | |
63 // Get children nodes data and pass it to 'IntentsView.loadChildren' to | |
64 // update the WebUI. | |
65 void SendChildren(WebIntentsTreeNode* parent); | |
66 | |
67 WebIntentsRegistry* web_intents_registry_; // Weak pointer. | |
68 | |
69 // Backing data model for the intents list. | |
70 scoped_ptr<WebIntentsModel> intents_tree_model_; | |
71 | |
72 // Flag to indicate whether there is a batch update in progress. | |
73 bool batch_update_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(WebIntentsSettingsHandler); | |
76 }; | |
77 | |
78 } // namespace options | |
79 | |
80 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_WEB_INTENTS_SETTINGS_HANDLER_H_ | |
OLD | NEW |