| OLD | NEW | 
|    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_UI_INTENTS_WEB_INTENTS_MODEL_H_ |    5 #ifndef CHROME_BROWSER_UI_INTENTS_WEB_INTENTS_MODEL_H_ | 
|    6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENTS_MODEL_H_ |    6 #define CHROME_BROWSER_UI_INTENTS_WEB_INTENTS_MODEL_H_ | 
|    7 #pragma once |    7 #pragma once | 
|    8  |    8  | 
|    9 #include "base/values.h" |    9 #include "base/values.h" | 
|   10 #include "chrome/browser/intents/web_intents_registry.h" |   10 #include "chrome/browser/intents/web_intents_registry.h" | 
|   11 #include "ui/base/models/tree_node_model.h" |   11 #include "ui/base/models/tree_node_model.h" | 
|   12  |   12  | 
|   13 class WebIntentsRegistry; |   13 class WebIntentsRegistry; | 
 |   14 struct DefaultWebIntentService; | 
|   14  |   15  | 
|   15 // The tree structure is a TYPE_ROOT node with title="", |   16 // The tree structure is a TYPE_ROOT node with title="", | 
|   16 // children are TYPE_ORIGIN nodes with title=origin, whose |   17 // children are TYPE_ORIGIN nodes with title=origin, whose | 
|   17 // children are TYPE_SERVICE nodes with title=origin, and |   18 // children are TYPE_SERVICE nodes with title=origin, and | 
|   18 // will be of type ServiceTreeNode with data on individual |   19 // will be of type ServiceTreeNode with data on individual | 
|   19 // services. |   20 // services. | 
|   20 class WebIntentsTreeNode : public ui::TreeNode<WebIntentsTreeNode> { |   21 class WebIntentsTreeNode : public ui::TreeNode<WebIntentsTreeNode> { | 
|   21  public: |   22  public: | 
|   22   WebIntentsTreeNode(); |   23   WebIntentsTreeNode(); | 
|   23   explicit WebIntentsTreeNode(const string16& title); |   24   explicit WebIntentsTreeNode(const string16& title); | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   98   WebIntentsTreeNode* GetTreeNode(std::string path_id); |   99   WebIntentsTreeNode* GetTreeNode(std::string path_id); | 
|   99   void GetChildNodeList(WebIntentsTreeNode* parent, int start, int count, |  100   void GetChildNodeList(WebIntentsTreeNode* parent, int start, int count, | 
|  100                         base::ListValue* nodes); |  101                         base::ListValue* nodes); | 
|  101   void GetWebIntentsTreeNodeDictionary(const WebIntentsTreeNode& node, |  102   void GetWebIntentsTreeNodeDictionary(const WebIntentsTreeNode& node, | 
|  102                                        base::DictionaryValue* dict); |  103                                        base::DictionaryValue* dict); | 
|  103  |  104  | 
|  104   virtual void OnIntentsQueryDone( |  105   virtual void OnIntentsQueryDone( | 
|  105       WebIntentsRegistry::QueryID query_id, |  106       WebIntentsRegistry::QueryID query_id, | 
|  106       const std::vector<webkit_glue::WebIntentServiceData>& services) OVERRIDE; |  107       const std::vector<webkit_glue::WebIntentServiceData>& services) OVERRIDE; | 
|  107  |  108  | 
 |  109   virtual void OnIntentsDefaultsQueryDone( | 
 |  110       WebIntentsRegistry::QueryID query_id, | 
 |  111       const DefaultWebIntentService& default_service) OVERRIDE; | 
 |  112  | 
|  108  private: |  113  private: | 
|  109   // Loads the data model from the WebIntentsRegistry. |  114   // Loads the data model from the WebIntentsRegistry. | 
|  110   // TODO(gbillock): need an observer on that to absorb async updates? |  115   // TODO(gbillock): need an observer on that to absorb async updates? | 
|  111   void LoadModel(); |  116   void LoadModel(); | 
|  112  |  117  | 
|  113   // Get the model node for a particular host. |  118   // Get the model node for a particular host. | 
|  114   WebIntentsTreeNode* GetNodeForHost(const std::string& host); |  119   WebIntentsTreeNode* GetNodeForHost(const std::string& host); | 
|  115  |  120  | 
|  116   // Do batch-specific notifies for updates coming from the LoadModel. |  121   // Do batch-specific notifies for updates coming from the LoadModel. | 
|  117   void NotifyObserverBeginBatch(); |  122   void NotifyObserverBeginBatch(); | 
|  118   void NotifyObserverEndBatch(); |  123   void NotifyObserverEndBatch(); | 
|  119  |  124  | 
|  120   // The backing registry. Weak pointer. |  125   // The backing registry. Weak pointer. | 
|  121   WebIntentsRegistry* intents_registry_; |  126   WebIntentsRegistry* intents_registry_; | 
|  122  |  127  | 
|  123   // Separate list of observers that'll get batch updates. |  128   // Separate list of observers that'll get batch updates. | 
|  124   ObserverList<Observer> intents_observer_list_; |  129   ObserverList<Observer> intents_observer_list_; | 
|  125  |  130  | 
|  126   // Batch update nesting level. Incremented to indicate that we're in |  131   // Batch update nesting level. Incremented to indicate that we're in | 
|  127   // the middle of a batch update. |  132   // the middle of a batch update. | 
|  128   int batch_update_; |  133   int batch_update_; | 
|  129 }; |  134 }; | 
|  130  |  135  | 
|  131 #endif  // CHROME_BROWSER_UI_INTENTS_WEB_INTENTS_MODEL_H_ |  136 #endif  // CHROME_BROWSER_UI_INTENTS_WEB_INTENTS_MODEL_H_ | 
| OLD | NEW |