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/chromeos/imageburner/imageburner_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/chromeos/imageburner/burn_controller.h" | 13 #include "chrome/browser/chromeos/imageburner/burn_controller.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "chrome/grit/generated_resources.h" |
16 #include "content/public/browser/web_ui.h" | 17 #include "content/public/browser/web_ui.h" |
17 #include "content/public/browser/web_ui_data_source.h" | 18 #include "content/public/browser/web_ui_data_source.h" |
18 #include "content/public/browser/web_ui_message_handler.h" | 19 #include "content/public/browser/web_ui_message_handler.h" |
19 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
20 #include "grit/generated_resources.h" | |
21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
22 #include "ui/base/l10n/time_format.h" | 22 #include "ui/base/l10n/time_format.h" |
23 #include "ui/base/text/bytes_formatting.h" | 23 #include "ui/base/text/bytes_formatting.h" |
24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
25 | 25 |
26 namespace chromeos { | 26 namespace chromeos { |
27 namespace imageburner { | 27 namespace imageburner { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 source->AddResourcePath("image_burner.js", IDR_IMAGEBURNER_JS); | 82 source->AddResourcePath("image_burner.js", IDR_IMAGEBURNER_JS); |
83 source->SetDefaultResource(IDR_IMAGEBURNER_HTML); | 83 source->SetDefaultResource(IDR_IMAGEBURNER_HTML); |
84 return source; | 84 return source; |
85 } | 85 } |
86 | 86 |
87 class WebUIHandler | 87 class WebUIHandler |
88 : public content::WebUIMessageHandler, | 88 : public content::WebUIMessageHandler, |
89 public BurnController::Delegate { | 89 public BurnController::Delegate { |
90 public: | 90 public: |
91 explicit WebUIHandler(content::WebContents* contents) | 91 explicit WebUIHandler(content::WebContents* contents) |
92 : burn_controller_(BurnController::CreateBurnController(contents, this)){ | 92 : burn_controller_(BurnController::CreateBurnController(contents, this)) { |
93 } | 93 } |
94 | 94 |
95 virtual ~WebUIHandler() { | 95 virtual ~WebUIHandler() { |
96 } | 96 } |
97 | 97 |
98 // WebUIMessageHandler implementation. | 98 // WebUIMessageHandler implementation. |
99 virtual void RegisterMessages() OVERRIDE { | 99 virtual void RegisterMessages() OVERRIDE { |
100 web_ui()->RegisterMessageCallback( | 100 web_ui()->RegisterMessageCallback( |
101 "getDevices", | 101 "getDevices", |
102 base::Bind(&WebUIHandler::HandleGetDevices, base::Unretained(this))); | 102 base::Bind(&WebUIHandler::HandleGetDevices, base::Unretained(this))); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 323 |
324 ImageBurnUI::ImageBurnUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 324 ImageBurnUI::ImageBurnUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
325 chromeos::imageburner::WebUIHandler* handler = | 325 chromeos::imageburner::WebUIHandler* handler = |
326 new chromeos::imageburner::WebUIHandler(web_ui->GetWebContents()); | 326 new chromeos::imageburner::WebUIHandler(web_ui->GetWebContents()); |
327 web_ui->AddMessageHandler(handler); | 327 web_ui->AddMessageHandler(handler); |
328 | 328 |
329 Profile* profile = Profile::FromWebUI(web_ui); | 329 Profile* profile = Profile::FromWebUI(web_ui); |
330 content::WebUIDataSource::Add( | 330 content::WebUIDataSource::Add( |
331 profile, chromeos::imageburner::CreateImageburnerUIHTMLSource()); | 331 profile, chromeos::imageburner::CreateImageburnerUIHTMLSource()); |
332 } | 332 } |
OLD | NEW |