| 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_UI_WEBUI_SYNC_INTERNALS_UI_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_UI_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_UI_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_UI_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "content/public/browser/web_ui_controller.h" | 14 #include "content/public/browser/web_ui_controller.h" |
| 15 #include "sync/js/js_event_handler.h" | 15 #include "sync/js/js_event_handler.h" |
| 16 #include "sync/js/js_reply_handler.h" | 16 #include "sync/js/js_reply_handler.h" |
| 17 | 17 |
| 18 namespace csync { | 18 namespace syncer { |
| 19 class JsController; | 19 class JsController; |
| 20 } // namespace csync | 20 } // namespace syncer |
| 21 | 21 |
| 22 // The implementation for the chrome://sync-internals page. | 22 // The implementation for the chrome://sync-internals page. |
| 23 class SyncInternalsUI : public content::WebUIController, | 23 class SyncInternalsUI : public content::WebUIController, |
| 24 public csync::JsEventHandler, | 24 public syncer::JsEventHandler, |
| 25 public csync::JsReplyHandler { | 25 public syncer::JsReplyHandler { |
| 26 public: | 26 public: |
| 27 explicit SyncInternalsUI(content::WebUI* web_ui); | 27 explicit SyncInternalsUI(content::WebUI* web_ui); |
| 28 virtual ~SyncInternalsUI(); | 28 virtual ~SyncInternalsUI(); |
| 29 | 29 |
| 30 // WebUIController implementation. | 30 // WebUIController implementation. |
| 31 // | 31 // |
| 32 // The following messages are processed: | 32 // The following messages are processed: |
| 33 // | 33 // |
| 34 // getAboutInfo(): | 34 // getAboutInfo(): |
| 35 // Immediately fires a onGetAboutInfoFinished() event with a | 35 // Immediately fires a onGetAboutInfoFinished() event with a |
| 36 // dictionary of sync-related stats and info. | 36 // dictionary of sync-related stats and info. |
| 37 // | 37 // |
| 38 // All other messages are routed to the sync service if it exists, | 38 // All other messages are routed to the sync service if it exists, |
| 39 // and dropped otherwise. | 39 // and dropped otherwise. |
| 40 // | 40 // |
| 41 // TODO(akalin): Add a simple isSyncEnabled() message and make | 41 // TODO(akalin): Add a simple isSyncEnabled() message and make |
| 42 // getAboutInfo() be handled by the sync service. | 42 // getAboutInfo() be handled by the sync service. |
| 43 virtual bool OverrideHandleWebUIMessage(const GURL& source_url, | 43 virtual bool OverrideHandleWebUIMessage(const GURL& source_url, |
| 44 const std::string& name, | 44 const std::string& name, |
| 45 const base::ListValue& args) OVERRIDE; | 45 const base::ListValue& args) OVERRIDE; |
| 46 | 46 |
| 47 // csync::JsEventHandler implementation. | 47 // syncer::JsEventHandler implementation. |
| 48 virtual void HandleJsEvent( | 48 virtual void HandleJsEvent( |
| 49 const std::string& name, | 49 const std::string& name, |
| 50 const csync::JsEventDetails& details) OVERRIDE; | 50 const syncer::JsEventDetails& details) OVERRIDE; |
| 51 | 51 |
| 52 // csync::JsReplyHandler implementation. | 52 // syncer::JsReplyHandler implementation. |
| 53 virtual void HandleJsReply( | 53 virtual void HandleJsReply( |
| 54 const std::string& name, | 54 const std::string& name, |
| 55 const csync::JsArgList& args) OVERRIDE; | 55 const syncer::JsArgList& args) OVERRIDE; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 base::WeakPtrFactory<SyncInternalsUI> weak_ptr_factory_; | 58 base::WeakPtrFactory<SyncInternalsUI> weak_ptr_factory_; |
| 59 base::WeakPtr<csync::JsController> js_controller_; | 59 base::WeakPtr<syncer::JsController> js_controller_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(SyncInternalsUI); | 61 DISALLOW_COPY_AND_ASSIGN(SyncInternalsUI); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_UI_H_ | 64 #endif // CHROME_BROWSER_UI_WEBUI_SYNC_INTERNALS_UI_H_ |
| OLD | NEW |