| 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_OPTIONS2_WEB_INTENTS_SETTINGS_HANDLER_H_ | |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_WEB_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/web_intents_model.h" | |
| 12 #include "chrome/browser/ui/webui/options2/options_ui.h" | |
| 13 | |
| 14 class WebIntentsRegistry; | |
| 15 | |
| 16 // Manage setting up the backing data for the web intents options page. | |
| 17 class WebIntentsSettingsHandler : public OptionsPage2UIHandler, | |
| 18 public WebIntentsModel::Observer { | |
| 19 public: | |
| 20 WebIntentsSettingsHandler(); | |
| 21 virtual ~WebIntentsSettingsHandler(); | |
| 22 | |
| 23 // OptionsPage2UIHandler implementation. | |
| 24 virtual void GetLocalizedValues( | |
| 25 base::DictionaryValue* localized_strings) OVERRIDE; | |
| 26 virtual void RegisterMessages() OVERRIDE; | |
| 27 | |
| 28 // WebIntentsModel::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(WebIntentsModel* model) OVERRIDE; | |
| 40 virtual void TreeModelEndBatch(WebIntentsModel* model) OVERRIDE; | |
| 41 | |
| 42 private: | |
| 43 // Creates the WebIntentsModel if neccessary. | |
| 44 void EnsureWebIntentsModelCreated(); | |
| 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(WebIntentsTreeNode* 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(WebIntentsTreeNode* parent); | |
| 65 | |
| 66 WebIntentsRegistry* web_intents_registry_; // Weak pointer. | |
| 67 | |
| 68 // Backing data model for the intents list. | |
| 69 scoped_ptr<WebIntentsModel> intents_tree_model_; | |
| 70 | |
| 71 // Flag to indicate whether there is a batch update in progress. | |
| 72 bool batch_update_; | |
| 73 | |
| 74 DISALLOW_COPY_AND_ASSIGN(WebIntentsSettingsHandler); | |
| 75 }; | |
| 76 | |
| 77 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_WEB_INTENTS_SETTINGS_HANDLER_H_ | |
| OLD | NEW |