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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper
s.h" | 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper
s.h" |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 std::string transition_type_string = | 114 std::string transition_type_string = |
115 ui::PageTransitionGetCoreTransitionString(transition_type); | 115 ui::PageTransitionGetCoreTransitionString(transition_type); |
116 // For webNavigation API backward compatibility, keep "start_page" even after | 116 // For webNavigation API backward compatibility, keep "start_page" even after |
117 // renamed to "auto_toplevel". | 117 // renamed to "auto_toplevel". |
118 if (ui::PageTransitionStripQualifier(transition_type) == | 118 if (ui::PageTransitionStripQualifier(transition_type) == |
119 ui::PAGE_TRANSITION_AUTO_TOPLEVEL) | 119 ui::PAGE_TRANSITION_AUTO_TOPLEVEL) |
120 transition_type_string = "start_page"; | 120 transition_type_string = "start_page"; |
121 dict->SetString(keys::kTransitionTypeKey, transition_type_string); | 121 dict->SetString(keys::kTransitionTypeKey, transition_type_string); |
122 base::ListValue* qualifiers = new base::ListValue(); | 122 base::ListValue* qualifiers = new base::ListValue(); |
123 if (transition_type & ui::PAGE_TRANSITION_CLIENT_REDIRECT) | 123 if (transition_type & ui::PAGE_TRANSITION_CLIENT_REDIRECT) |
124 qualifiers->Append(new base::StringValue("client_redirect")); | 124 qualifiers->AppendString("client_redirect"); |
125 if (transition_type & ui::PAGE_TRANSITION_SERVER_REDIRECT) | 125 if (transition_type & ui::PAGE_TRANSITION_SERVER_REDIRECT) |
126 qualifiers->Append(new base::StringValue("server_redirect")); | 126 qualifiers->AppendString("server_redirect"); |
127 if (transition_type & ui::PAGE_TRANSITION_FORWARD_BACK) | 127 if (transition_type & ui::PAGE_TRANSITION_FORWARD_BACK) |
128 qualifiers->Append(new base::StringValue("forward_back")); | 128 qualifiers->AppendString("forward_back"); |
129 if (transition_type & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) | 129 if (transition_type & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR) |
130 qualifiers->Append(new base::StringValue("from_address_bar")); | 130 qualifiers->AppendString("from_address_bar"); |
131 dict->Set(keys::kTransitionQualifiersKey, qualifiers); | 131 dict->Set(keys::kTransitionQualifiersKey, qualifiers); |
132 dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); | 132 dict->SetDouble(keys::kTimeStampKey, MilliSecondsFromTime(base::Time::Now())); |
133 args->Append(dict); | 133 args->Append(dict); |
134 | 134 |
135 std::unique_ptr<Event> event( | 135 std::unique_ptr<Event> event( |
136 new Event(histogram_value, event_name, std::move(args))); | 136 new Event(histogram_value, event_name, std::move(args))); |
137 DispatchEvent(navigation_handle->GetWebContents()->GetBrowserContext(), | 137 DispatchEvent(navigation_handle->GetWebContents()->GetBrowserContext(), |
138 std::move(event), url); | 138 std::move(event), url); |
139 } | 139 } |
140 | 140 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 std::unique_ptr<Event> event( | 257 std::unique_ptr<Event> event( |
258 new Event(events::WEB_NAVIGATION_ON_TAB_REPLACED, | 258 new Event(events::WEB_NAVIGATION_ON_TAB_REPLACED, |
259 web_navigation::OnTabReplaced::kEventName, | 259 web_navigation::OnTabReplaced::kEventName, |
260 web_navigation::OnTabReplaced::Create(details))); | 260 web_navigation::OnTabReplaced::Create(details))); |
261 DispatchEvent(browser_context, std::move(event), GURL()); | 261 DispatchEvent(browser_context, std::move(event), GURL()); |
262 } | 262 } |
263 | 263 |
264 } // namespace web_navigation_api_helpers | 264 } // namespace web_navigation_api_helpers |
265 | 265 |
266 } // namespace extensions | 266 } // namespace extensions |
OLD | NEW |