local_discovery_ui.cc revision 9ab5563a3196760eb381d102cbb2bc0f7abc6a50
1// Copyright 2013 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#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h" 6 7#include "chrome/browser/profiles/profile.h" 8#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" 9#include "chrome/common/url_constants.h" 10#include "content/public/browser/web_ui.h" 11#include "content/public/browser/web_ui_data_source.h" 12#include "grit/browser_resources.h" 13 14namespace { 15 16content::WebUIDataSource* CreateLocalDiscoveryHTMLSource() { 17 content::WebUIDataSource* source = 18 content::WebUIDataSource::Create(chrome::kChromeUIDevicesHost); 19 20 source->SetDefaultResource(IDR_LOCAL_DISCOVERY_HTML); 21 source->AddResourcePath("local_discovery.css", IDR_LOCAL_DISCOVERY_CSS); 22 source->AddResourcePath("local_discovery.js", IDR_LOCAL_DISCOVERY_JS); 23 return source; 24} 25 26} // namespace 27 28LocalDiscoveryUI::LocalDiscoveryUI(content::WebUI* web_ui) 29 : WebUIController(web_ui) { 30 // Set up the chrome://devices/ source. 31 Profile* profile = Profile::FromWebUI(web_ui); 32 content::WebUIDataSource::Add(profile, CreateLocalDiscoveryHTMLSource()); 33 34 // TODO(gene): Use LocalDiscoveryUIHandler to send updated to the devices 35 // page. For example 36 // web_ui->AddMessageHandler(new LocalDiscoveryUIHandler()); 37} 38