Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc

Issue 137833002: Fix an out-of-date issue in chrome.webNavigation document. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reset "start_page" Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/common/extensions/api/web_navigation.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 bool is_main_frame, 92 bool is_main_frame,
93 const GURL& url, 93 const GURL& url,
94 content::PageTransition transition_type) { 94 content::PageTransition transition_type) {
95 scoped_ptr<base::ListValue> args(new base::ListValue()); 95 scoped_ptr<base::ListValue> args(new base::ListValue());
96 base::DictionaryValue* dict = new base::DictionaryValue(); 96 base::DictionaryValue* dict = new base::DictionaryValue();
97 dict->SetInteger(keys::kTabIdKey, ExtensionTabUtil::GetTabId(web_contents)); 97 dict->SetInteger(keys::kTabIdKey, ExtensionTabUtil::GetTabId(web_contents));
98 dict->SetString(keys::kUrlKey, url.spec()); 98 dict->SetString(keys::kUrlKey, url.spec());
99 dict->SetInteger(keys::kProcessIdKey, 99 dict->SetInteger(keys::kProcessIdKey,
100 web_contents->GetRenderViewHost()->GetProcess()->GetID()); 100 web_contents->GetRenderViewHost()->GetProcess()->GetID());
101 dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id)); 101 dict->SetInteger(keys::kFrameIdKey, GetFrameId(is_main_frame, frame_id));
102 dict->SetString( 102 std::string transition_type_string =
103 keys::kTransitionTypeKey, 103 content::PageTransitionGetCoreTransitionString(transition_type);
104 content::PageTransitionGetCoreTransitionString(transition_type)); 104 // For webNavigation API backward compatibility, keep "start_page" even after
105 // renamed to "auto_toplevel".
106 if (transition_type_string == "auto_toplevel")
jochen (gone - plz use gerrit) 2014/01/22 11:30:02 nit transition_type == PAGE_TRANSITION_TYPE_AUTO_T
Haojian Wu 2014/01/22 12:05:13 Done.
107 transition_type_string = "start_page";
108 dict->SetString(keys::kTransitionTypeKey, transition_type_string);
105 base::ListValue* qualifiers = new base::ListValue(); 109 base::ListValue* qualifiers = new base::ListValue();
106 if (transition_type & content::PAGE_TRANSITION_CLIENT_REDIRECT) 110 if (transition_type & content::PAGE_TRANSITION_CLIENT_REDIRECT)
107 qualifiers->Append(new base::StringValue("client_redirect")); 111 qualifiers->Append(new base::StringValue("client_redirect"));
108 if (transition_type & content::PAGE_TRANSITION_SERVER_REDIRECT) 112 if (transition_type & content::PAGE_TRANSITION_SERVER_REDIRECT)
109 qualifiers->Append(new base::StringValue("server_redirect")); 113 qualifiers->Append(new base::StringValue("server_redirect"));
110 if (transition_type & content::PAGE_TRANSITION_FORWARD_BACK) 114 if (transition_type & content::PAGE_TRANSITION_FORWARD_BACK)
111 qualifiers->Append(new base::StringValue("forward_back")); 115 qualifiers->Append(new base::StringValue("forward_back"));
112 if (transition_type & content::PAGE_TRANSITION_FROM_ADDRESS_BAR) 116 if (transition_type & content::PAGE_TRANSITION_FROM_ADDRESS_BAR)
113 qualifiers->Append(new base::StringValue("from_address_bar")); 117 qualifiers->Append(new base::StringValue("from_address_bar"));
114 dict->Set(keys::kTransitionQualifiersKey, qualifiers); 118 dict->Set(keys::kTransitionQualifiersKey, qualifiers);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 241
238 DispatchEvent(browser_context, 242 DispatchEvent(browser_context,
239 web_navigation::OnTabReplaced::kEventName, 243 web_navigation::OnTabReplaced::kEventName,
240 args.Pass(), 244 args.Pass(),
241 GURL()); 245 GURL());
242 } 246 }
243 247
244 } // namespace web_navigation_api_helpers 248 } // namespace web_navigation_api_helpers
245 249
246 } // namespace extensions 250 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/api/web_navigation.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698