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 #include "chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h" |
6 #include "chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h" | 6 #include "chrome/browser/ui/webui/chromeos/imageburner/webui_handler.h" |
7 | 7 |
| 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" |
8 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
9 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
10 #include "base/task.h" | 12 #include "base/task.h" |
11 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
12 #include "base/values.h" | 14 #include "base/values.h" |
13 #include "chrome/browser/chromeos/system/statistics_provider.h" | 15 #include "chrome/browser/chromeos/system/statistics_provider.h" |
14 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/common/jstemplate_builder.h" | 17 #include "chrome/common/jstemplate_builder.h" |
16 #include "chrome/common/time_format.h" | 18 #include "chrome/common/time_format.h" |
17 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (state_machine_) | 179 if (state_machine_) |
178 state_machine_->RemoveObserver(this); | 180 state_machine_->RemoveObserver(this); |
179 } | 181 } |
180 | 182 |
181 WebUIMessageHandler* WebUIHandler::Attach(WebUI* web_ui) { | 183 WebUIMessageHandler* WebUIHandler::Attach(WebUI* web_ui) { |
182 return WebUIMessageHandler::Attach(web_ui); | 184 return WebUIMessageHandler::Attach(web_ui); |
183 } | 185 } |
184 | 186 |
185 void WebUIHandler::RegisterMessages() { | 187 void WebUIHandler::RegisterMessages() { |
186 web_ui_->RegisterMessageCallback("getDevices", | 188 web_ui_->RegisterMessageCallback("getDevices", |
187 NewCallback(this, &WebUIHandler::HandleGetDevices)); | 189 base::Bind(&WebUIHandler::HandleGetDevices, base::Unretained(this))); |
188 web_ui_->RegisterMessageCallback("burnImage", | 190 web_ui_->RegisterMessageCallback("burnImage", |
189 NewCallback(this, &WebUIHandler::HandleBurnImage)); | 191 base::Bind(&WebUIHandler::HandleBurnImage, base::Unretained(this))); |
190 web_ui_->RegisterMessageCallback("cancelBurnImage", | 192 web_ui_->RegisterMessageCallback("cancelBurnImage", |
191 NewCallback(this, &WebUIHandler::HandleCancelBurnImage)); | 193 base::Bind(&WebUIHandler::HandleCancelBurnImage, base::Unretained(this))); |
192 web_ui_->RegisterMessageCallback("webuiInitialized", | 194 web_ui_->RegisterMessageCallback("webuiInitialized", |
193 NewCallback(this, &WebUIHandler::HandleWebUIInitialized)); | 195 base::Bind(&WebUIHandler::HandleWebUIInitialized, |
| 196 base::Unretained(this))); |
194 } | 197 } |
195 | 198 |
196 void WebUIHandler::DiskChanged(chromeos::MountLibraryEventType event, | 199 void WebUIHandler::DiskChanged(chromeos::MountLibraryEventType event, |
197 const chromeos::MountLibrary::Disk* disk) { | 200 const chromeos::MountLibrary::Disk* disk) { |
198 if (!disk->is_parent() || disk->on_boot_device()) | 201 if (!disk->is_parent() || disk->on_boot_device()) |
199 return; | 202 return; |
200 if (event == chromeos::MOUNT_DISK_ADDED) { | 203 if (event == chromeos::MOUNT_DISK_ADDED) { |
201 DictionaryValue disk_value; | 204 DictionaryValue disk_value; |
202 CreateDiskValue(*disk, &disk_value); | 205 CreateDiskValue(*disk, &disk_value); |
203 web_ui_->CallJavascriptFunction("browserBridge.deviceAdded", disk_value); | 206 web_ui_->CallJavascriptFunction("browserBridge.deviceAdded", disk_value); |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 // | 667 // |
665 //////////////////////////////////////////////////////////////////////////////// | 668 //////////////////////////////////////////////////////////////////////////////// |
666 | 669 |
667 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) { | 670 ImageBurnUI::ImageBurnUI(TabContents* contents) : ChromeWebUI(contents) { |
668 imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents); | 671 imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents); |
669 AddMessageHandler((handler)->Attach(this)); | 672 AddMessageHandler((handler)->Attach(this)); |
670 imageburner::UIHTMLSource* html_source = new imageburner::UIHTMLSource(); | 673 imageburner::UIHTMLSource* html_source = new imageburner::UIHTMLSource(); |
671 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 674 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
672 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 675 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
673 } | 676 } |
OLD | NEW |