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