OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "content/shell/browser/blink_test_controller.h" | 5 #include "content/shell/browser/blink_test_controller.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 DiscardMainWindow(); | 720 DiscardMainWindow(); |
721 } | 721 } |
722 | 722 |
723 void BlinkTestController::OnSetBluetoothManualChooser(bool enable) { | 723 void BlinkTestController::OnSetBluetoothManualChooser(bool enable) { |
724 bluetooth_chooser_factory_.reset(); | 724 bluetooth_chooser_factory_.reset(); |
725 if (enable) { | 725 if (enable) { |
726 bluetooth_chooser_factory_.reset(new LayoutTestBluetoothChooserFactory()); | 726 bluetooth_chooser_factory_.reset(new LayoutTestBluetoothChooserFactory()); |
727 } | 727 } |
728 } | 728 } |
729 | 729 |
730 void BlinkTestController::OnGetBluetoothManualChooserEvents( | 730 void BlinkTestController::OnGetBluetoothManualChooserEvents() { |
731 std::vector<std::string>* events) { | |
732 if (!bluetooth_chooser_factory_) { | 731 if (!bluetooth_chooser_factory_) { |
733 printer_->AddErrorMessage( | 732 printer_->AddErrorMessage( |
734 "FAIL: Must call setBluetoothManualChooser before " | 733 "FAIL: Must call setBluetoothManualChooser before " |
735 "getBluetoothManualChooserEvents."); | 734 "getBluetoothManualChooserEvents."); |
736 return; | 735 return; |
737 } | 736 } |
738 *events = bluetooth_chooser_factory_->GetAndResetEvents(); | 737 Send(new ShellViewMsg_ReplyBluetoothManualChooserEvents( |
| 738 main_window_->web_contents()->GetRoutingID(), |
| 739 bluetooth_chooser_factory_->GetAndResetEvents())); |
739 } | 740 } |
740 | 741 |
741 void BlinkTestController::OnSendBluetoothManualChooserEvent( | 742 void BlinkTestController::OnSendBluetoothManualChooserEvent( |
742 const std::string& event_name, | 743 const std::string& event_name, |
743 const std::string& argument) { | 744 const std::string& argument) { |
744 if (!bluetooth_chooser_factory_) { | 745 if (!bluetooth_chooser_factory_) { |
745 printer_->AddErrorMessage( | 746 printer_->AddErrorMessage( |
746 "FAIL: Must call setBluetoothManualChooser before " | 747 "FAIL: Must call setBluetoothManualChooser before " |
747 "sendBluetoothManualChooserEvent."); | 748 "sendBluetoothManualChooserEvent."); |
748 return; | 749 return; |
749 } | 750 } |
750 BluetoothChooser::Event event; | 751 BluetoothChooser::Event event; |
751 if (event_name == "cancelled") { | 752 if (event_name == "cancelled") { |
752 event = BluetoothChooser::Event::CANCELLED; | 753 event = BluetoothChooser::Event::CANCELLED; |
753 } else if (event_name == "selected") { | 754 } else if (event_name == "selected") { |
754 event = BluetoothChooser::Event::SELECTED; | 755 event = BluetoothChooser::Event::SELECTED; |
755 } else { | 756 } else { |
756 printer_->AddErrorMessage(base::StringPrintf( | 757 printer_->AddErrorMessage(base::StringPrintf( |
757 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", | 758 "FAIL: Unexpected sendBluetoothManualChooserEvent() event name '%s'.", |
758 event_name.c_str())); | 759 event_name.c_str())); |
759 return; | 760 return; |
760 } | 761 } |
761 bluetooth_chooser_factory_->SendEvent(event, argument); | 762 bluetooth_chooser_factory_->SendEvent(event, argument); |
762 } | 763 } |
763 | 764 |
764 } // namespace content | 765 } // namespace content |
OLD | NEW |