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 #include "chrome/browser/ui/webui/sync_internals_ui.h" | 5 #include "chrome/browser/ui/webui/sync_internals_ui.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
8 #include "chrome/browser/ui/webui/sync_internals_message_handler.h" | 8 #include "chrome/browser/ui/webui/sync_internals_message_handler.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "components/sync_driver/about_sync_util.h" |
10 #include "content/public/browser/web_ui.h" | 11 #include "content/public/browser/web_ui.h" |
11 #include "content/public/browser/web_ui_data_source.h" | 12 #include "content/public/browser/web_ui_data_source.h" |
12 #include "grit/sync_internals_resources.h" | 13 #include "grit/components_resources.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 content::WebUIDataSource* CreateSyncInternalsHTMLSource() { | 17 content::WebUIDataSource* CreateSyncInternalsHTMLSource() { |
17 content::WebUIDataSource* source = | 18 content::WebUIDataSource* source = |
18 content::WebUIDataSource::Create(chrome::kChromeUISyncInternalsHost); | 19 content::WebUIDataSource::Create(chrome::kChromeUISyncInternalsHost); |
19 | 20 |
20 source->SetJsonPath("strings.js"); | 21 source->SetJsonPath("strings.js"); |
21 source->AddResourcePath("sync_index.js", IDR_SYNC_INTERNALS_INDEX_JS); | 22 source->AddResourcePath(sync_driver::kSyncIndexJS, |
22 source->AddResourcePath("chrome_sync.js", | 23 IDR_SYNC_DRIVER_SYNC_INTERNALS_INDEX_JS); |
23 IDR_SYNC_INTERNALS_CHROME_SYNC_JS); | 24 source->AddResourcePath(sync_driver::kChromeSyncJS, |
24 source->AddResourcePath("types.js", IDR_SYNC_INTERNALS_TYPES_JS); | 25 IDR_SYNC_DRIVER_SYNC_INTERNALS_CHROME_SYNC_JS); |
25 source->AddResourcePath("sync_log.js", IDR_SYNC_INTERNALS_SYNC_LOG_JS); | 26 source->AddResourcePath(sync_driver::kTypesJS, |
26 source->AddResourcePath("sync_node_browser.js", | 27 IDR_SYNC_DRIVER_SYNC_INTERNALS_TYPES_JS); |
27 IDR_SYNC_INTERNALS_SYNC_NODE_BROWSER_JS); | 28 source->AddResourcePath(sync_driver::kSyncLogJS, |
28 source->AddResourcePath("sync_search.js", | 29 IDR_SYNC_DRIVER_SYNC_INTERNALS_SYNC_LOG_JS); |
29 IDR_SYNC_INTERNALS_SYNC_SEARCH_JS); | 30 source->AddResourcePath(sync_driver::kSyncNodeBrowserJS, |
30 source->AddResourcePath("about.js", IDR_SYNC_INTERNALS_ABOUT_JS); | 31 IDR_SYNC_DRIVER_SYNC_INTERNALS_SYNC_NODE_BROWSER_JS); |
31 source->AddResourcePath("data.js", IDR_SYNC_INTERNALS_DATA_JS); | 32 source->AddResourcePath(sync_driver::kSyncSearchJS, |
32 source->AddResourcePath("events.js", IDR_SYNC_INTERNALS_EVENTS_JS); | 33 IDR_SYNC_DRIVER_SYNC_INTERNALS_SYNC_SEARCH_JS); |
33 source->AddResourcePath("search.js", IDR_SYNC_INTERNALS_SEARCH_JS); | 34 source->AddResourcePath(sync_driver::kAboutJS, |
34 source->SetDefaultResource(IDR_SYNC_INTERNALS_INDEX_HTML); | 35 IDR_SYNC_DRIVER_SYNC_INTERNALS_ABOUT_JS); |
| 36 source->AddResourcePath(sync_driver::kDataJS, |
| 37 IDR_SYNC_DRIVER_SYNC_INTERNALS_DATA_JS); |
| 38 source->AddResourcePath(sync_driver::kEventsJS, |
| 39 IDR_SYNC_DRIVER_SYNC_INTERNALS_EVENTS_JS); |
| 40 source->AddResourcePath(sync_driver::kSearchJS, |
| 41 IDR_SYNC_DRIVER_SYNC_INTERNALS_SEARCH_JS); |
| 42 source->SetDefaultResource(IDR_SYNC_DRIVER_SYNC_INTERNALS_INDEX_HTML); |
35 return source; | 43 return source; |
36 } | 44 } |
37 | 45 |
38 } // namespace | 46 } // namespace |
39 | 47 |
40 SyncInternalsUI::SyncInternalsUI(content::WebUI* web_ui) | 48 SyncInternalsUI::SyncInternalsUI(content::WebUI* web_ui) |
41 : WebUIController(web_ui) { | 49 : WebUIController(web_ui) { |
42 Profile* profile = Profile::FromWebUI(web_ui); | 50 Profile* profile = Profile::FromWebUI(web_ui); |
43 content::WebUIDataSource::Add(profile, CreateSyncInternalsHTMLSource()); | 51 content::WebUIDataSource::Add(profile, CreateSyncInternalsHTMLSource()); |
44 | 52 |
45 web_ui->AddMessageHandler(new SyncInternalsMessageHandler); | 53 web_ui->AddMessageHandler(new SyncInternalsMessageHandler); |
46 } | 54 } |
47 | 55 |
48 SyncInternalsUI::~SyncInternalsUI() {} | 56 SyncInternalsUI::~SyncInternalsUI() {} |
49 | 57 |
OLD | NEW |