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 #include <utility> |
7 | 8 |
8 #include "base/base64.h" | 9 #include "base/base64.h" |
9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
10 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
11 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_piece.h" | 16 #include "base/strings/string_piece.h" |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 61 |
61 private: | 62 private: |
62 static scoped_ptr<base::ListValue> BuildEventArguments( | 63 static scoped_ptr<base::ListValue> BuildEventArguments( |
63 const bool last_message, | 64 const bool last_message, |
64 const std::string& data) { | 65 const std::string& data) { |
65 base::DictionaryValue* event = new base::DictionaryValue(); | 66 base::DictionaryValue* event = new base::DictionaryValue(); |
66 event->SetBoolean("lastMessage", last_message); | 67 event->SetBoolean("lastMessage", last_message); |
67 event->SetString("data", data); | 68 event->SetString("data", data); |
68 scoped_ptr<base::ListValue> arguments(new base::ListValue()); | 69 scoped_ptr<base::ListValue> arguments(new base::ListValue()); |
69 arguments->Append(event); | 70 arguments->Append(event); |
70 return arguments.Pass(); | 71 return arguments; |
71 } | 72 } |
72 | 73 |
73 static scoped_ptr<Event> BuildEvent(scoped_ptr<base::ListValue> event_args, | 74 static scoped_ptr<Event> BuildEvent(scoped_ptr<base::ListValue> event_args, |
74 Profile* profile, | 75 Profile* profile, |
75 GURL event_url) { | 76 GURL event_url) { |
76 scoped_ptr<Event> event(new Event(events::TEST_ON_MESSAGE, "test.onMessage", | 77 scoped_ptr<Event> event(new Event(events::TEST_ON_MESSAGE, "test.onMessage", |
77 event_args.Pass())); | 78 std::move(event_args))); |
78 event->restrict_to_browser_context = profile; | 79 event->restrict_to_browser_context = profile; |
79 event->event_url = event_url; | 80 event->event_url = event_url; |
80 return event.Pass(); | 81 return event; |
81 } | 82 } |
82 | 83 |
83 void Observe(int type, | 84 void Observe(int type, |
84 const content::NotificationSource& source, | 85 const content::NotificationSource& source, |
85 const content::NotificationDetails& details) override { | 86 const content::NotificationDetails& details) override { |
86 DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD, | 87 DCHECK_EQ(extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD, |
87 type); | 88 type); |
88 EventRouter* event_router = | 89 EventRouter* event_router = |
89 EventRouter::Get(content::Source<Profile>(source).ptr()); | 90 EventRouter::Get(content::Source<Profile>(source).ptr()); |
90 | 91 |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); | 1206 ui_test_utils::NavigateToURL(browser(), chromium_org_url()); |
1206 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, | 1207 EXPECT_EQ(COULD_NOT_ESTABLISH_CONNECTION_ERROR, |
1207 CanConnectAndSendMessagesToMainFrame(invalid.get())); | 1208 CanConnectAndSendMessagesToMainFrame(invalid.get())); |
1208 } | 1209 } |
1209 | 1210 |
1210 #endif // !defined(OS_WIN) - http://crbug.com/350517. | 1211 #endif // !defined(OS_WIN) - http://crbug.com/350517. |
1211 | 1212 |
1212 } // namespace | 1213 } // namespace |
1213 | 1214 |
1214 }; // namespace extensions | 1215 }; // namespace extensions |
OLD | NEW |