| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 |
| 8 #include <memory> |
| 7 #include <utility> | 9 #include <utility> |
| 8 | 10 |
| 9 #include "base/base64.h" | 11 #include "base/base64.h" |
| 10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 11 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
| 12 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 15 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 MessageSender() { | 60 MessageSender() { |
| 59 registrar_.Add(this, | 61 registrar_.Add(this, |
| 60 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD, | 62 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD, |
| 61 content::NotificationService::AllSources()); | 63 content::NotificationService::AllSources()); |
| 62 } | 64 } |
| 63 | 65 |
| 64 private: | 66 private: |
| 65 static std::unique_ptr<base::ListValue> BuildEventArguments( | 67 static std::unique_ptr<base::ListValue> BuildEventArguments( |
| 66 const bool last_message, | 68 const bool last_message, |
| 67 const std::string& data) { | 69 const std::string& data) { |
| 68 base::DictionaryValue* event = new base::DictionaryValue(); | 70 std::unique_ptr<base::DictionaryValue> event(new base::DictionaryValue()); |
| 69 event->SetBoolean("lastMessage", last_message); | 71 event->SetBoolean("lastMessage", last_message); |
| 70 event->SetString("data", data); | 72 event->SetString("data", data); |
| 71 std::unique_ptr<base::ListValue> arguments(new base::ListValue()); | 73 std::unique_ptr<base::ListValue> arguments(new base::ListValue()); |
| 72 arguments->Append(event); | 74 arguments->Append(std::move(event)); |
| 73 return arguments; | 75 return arguments; |
| 74 } | 76 } |
| 75 | 77 |
| 76 static std::unique_ptr<Event> BuildEvent( | 78 static std::unique_ptr<Event> BuildEvent( |
| 77 std::unique_ptr<base::ListValue> event_args, | 79 std::unique_ptr<base::ListValue> event_args, |
| 78 Profile* profile, | 80 Profile* profile, |
| 79 GURL event_url) { | 81 GURL event_url) { |
| 80 std::unique_ptr<Event> event(new Event( | 82 std::unique_ptr<Event> event(new Event( |
| 81 events::TEST_ON_MESSAGE, "test.onMessage", std::move(event_args))); | 83 events::TEST_ON_MESSAGE, "test.onMessage", std::move(event_args))); |
| 82 event->restrict_to_browser_context = profile; | 84 event->restrict_to_browser_context = profile; |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); | 1253 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); |
| 1252 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, | 1254 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, |
| 1253 CanConnectAndSendMessagesToMainFrame(invalid.get())); | 1255 CanConnectAndSendMessagesToMainFrame(invalid.get())); |
| 1254 } | 1256 } |
| 1255 | 1257 |
| 1256 #endif // !defined(OS_WIN) - http://crbug.com/350517. | 1258 #endif // !defined(OS_WIN) - http://crbug.com/350517. |
| 1257 | 1259 |
| 1258 } // namespace | 1260 } // namespace |
| 1259 | 1261 |
| 1260 }; // namespace extensions | 1262 }; // namespace extensions |
| OLD | NEW |