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

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

Issue 1670673003: Refactor the implementation of the webNavigation extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Bug-532666-NavigationHandleAPI
Patch Set: Reverting the workaround from https://codereview.chromium.org/1656613002. Remove tests from exclusi… Created 4 years, 10 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
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.h" 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h"
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta nts.h" 11 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta nts.h"
12 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper s.h" 12 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_helper s.h"
13 #include "chrome/browser/extensions/extension_tab_util.h" 13 #include "chrome/browser/extensions/extension_tab_util.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/tab_contents/retargeting_details.h" 15 #include "chrome/browser/tab_contents/retargeting_details.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/browser_list.h" 17 #include "chrome/browser/ui/browser_list.h"
18 #include "chrome/common/extensions/api/web_navigation.h" 18 #include "chrome/common/extensions/api/web_navigation.h"
19 #include "content/public/browser/navigation_details.h" 19 #include "content/public/browser/navigation_details.h"
20 #include "content/public/browser/navigation_handle.h"
20 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
21 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
22 #include "content/public/browser/render_frame_host.h" 23 #include "content/public/browser/render_frame_host.h"
23 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/resource_request_details.h" 25 #include "content/public/browser/resource_request_details.h"
25 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
26 #include "content/public/common/url_constants.h" 27 #include "content/public/common/url_constants.h"
27 #include "extensions/browser/event_router.h" 28 #include "extensions/browser/event_router.h"
28 #include "extensions/browser/extension_api_frame_id_map.h" 29 #include "extensions/browser/extension_api_frame_id_map.h"
29 #include "extensions/browser/view_type_utils.h" 30 #include "extensions/browser/view_type_utils.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // static 234 // static
234 WebNavigationTabObserver* WebNavigationTabObserver::Get( 235 WebNavigationTabObserver* WebNavigationTabObserver::Get(
235 content::WebContents* web_contents) { 236 content::WebContents* web_contents) {
236 TabObserverMap::iterator i = g_tab_observer.Get().find(web_contents); 237 TabObserverMap::iterator i = g_tab_observer.Get().find(web_contents);
237 return i == g_tab_observer.Get().end() ? NULL : i->second; 238 return i == g_tab_observer.Get().end() ? NULL : i->second;
238 } 239 }
239 240
240 void WebNavigationTabObserver::RenderFrameDeleted( 241 void WebNavigationTabObserver::RenderFrameDeleted(
241 content::RenderFrameHost* render_frame_host) { 242 content::RenderFrameHost* render_frame_host) {
242 if (navigation_state_.CanSendEvents(render_frame_host) && 243 if (navigation_state_.CanSendEvents(render_frame_host) &&
243 !navigation_state_.GetNavigationCompleted(render_frame_host)) { 244 !navigation_state_.GetDocumentLoadCompleted(render_frame_host)) {
244 helpers::DispatchOnErrorOccurred( 245 helpers::DispatchOnErrorOccurred(
245 web_contents(), 246 web_contents(),
246 render_frame_host, 247 render_frame_host,
247 navigation_state_.GetUrl(render_frame_host), 248 navigation_state_.GetUrl(render_frame_host),
248 net::ERR_ABORTED); 249 net::ERR_ABORTED);
249 navigation_state_.SetErrorOccurredInFrame(render_frame_host); 250 navigation_state_.SetErrorOccurredInFrame(render_frame_host);
250 } 251 }
251 } 252 }
252 253
253 void WebNavigationTabObserver::FrameDeleted( 254 void WebNavigationTabObserver::FrameDeleted(
254 content::RenderFrameHost* render_frame_host) { 255 content::RenderFrameHost* render_frame_host) {
255 navigation_state_.FrameHostDeleted(render_frame_host); 256 navigation_state_.FrameHostDeleted(render_frame_host);
256 } 257 }
257 258
258 void WebNavigationTabObserver::RenderFrameHostChanged( 259 void WebNavigationTabObserver::RenderFrameHostChanged(
259 content::RenderFrameHost* old_host, 260 content::RenderFrameHost* old_host,
260 content::RenderFrameHost* new_host) { 261 content::RenderFrameHost* new_host) {
261 if (old_host) { 262 if (old_host) {
262 RenderFrameDeleted(old_host); 263 RenderFrameDeleted(old_host);
263 navigation_state_.FrameHostDeleted(old_host); 264 navigation_state_.FrameHostDeleted(old_host);
264 } 265 }
265 266
266 navigation_state_.FrameHostCreated(new_host); 267 navigation_state_.FrameHostCreated(new_host);
267 } 268 }
268 269
269 void WebNavigationTabObserver::DidStartProvisionalLoadForFrame( 270 void WebNavigationTabObserver::DidStartNavigation(
270 content::RenderFrameHost* render_frame_host, 271 content::NavigationHandle* navigation_handle) {
271 const GURL& validated_url, 272 if (navigation_handle->IsSynchronousNavigation())
272 bool is_error_page,
273 bool is_iframe_srcdoc) {
274 DVLOG(2) << "DidStartProvisionalLoad("
275 << "render_frame_host=" << render_frame_host
276 << ", frame_num=" << render_frame_host->GetRoutingID()
277 << ", url=" << validated_url << ")";
278 navigation_state_.StartTrackingNavigation(render_frame_host, validated_url,
279 is_error_page, is_iframe_srcdoc);
280
281 if (!navigation_state_.CanSendEvents(render_frame_host))
282 return; 273 return;
283 274
284 helpers::DispatchOnBeforeNavigate( 275 if (!FrameNavigationState::IsValidUrl(navigation_handle->GetURL()))
Devlin 2016/02/09 17:35:40 nit: combine with above if?
nasko 2016/02/09 17:53:54 Done.
285 web_contents(), 276 return;
286 render_frame_host, 277
287 navigation_state_.GetUrl(render_frame_host)); 278 helpers::DispatchOnBeforeNavigate(navigation_handle);
288 } 279 }
289 280
290 void WebNavigationTabObserver::DidCommitProvisionalLoadForFrame( 281 void WebNavigationTabObserver::DidFinishNavigation(
291 content::RenderFrameHost* render_frame_host, 282 content::NavigationHandle* navigation_handle) {
292 const GURL& url, 283 if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) {
293 ui::PageTransition transition_type) { 284 HandleCommit(navigation_handle);
294 DVLOG(2) << "DidCommitProvisionalLoad(" 285 return;
295 << "render_frame_host=" << render_frame_host 286 }
296 << ", frame_num=" << render_frame_host->GetRoutingID()
297 << ", url=" << url << ")";
298 bool is_reference_fragment_navigation =
299 IsReferenceFragmentNavigation(render_frame_host, url);
300 bool is_history_state_modification =
301 navigation_state_.GetNavigationCommitted(render_frame_host);
302 287
303 // Update the URL as it might have changed. 288 HandleError(navigation_handle);
304 navigation_state_.UpdateFrame(render_frame_host, url);
305 navigation_state_.SetNavigationCommitted(render_frame_host);
306
307 if (!navigation_state_.CanSendEvents(render_frame_host))
308 return;
309
310 events::HistogramValue histogram_value = events::UNKNOWN;
311 std::string event_name;
312 if (is_reference_fragment_navigation) {
313 histogram_value = events::WEB_NAVIGATION_ON_REFERENCE_FRAGMENT_UPDATED;
314 event_name = web_navigation::OnReferenceFragmentUpdated::kEventName;
315 } else if (is_history_state_modification) {
316 histogram_value = events::WEB_NAVIGATION_ON_HISTORY_STATE_UPDATED;
317 event_name = web_navigation::OnHistoryStateUpdated::kEventName;
318 } else {
319 if (navigation_state_.GetIsServerRedirected(render_frame_host)) {
320 transition_type = ui::PageTransitionFromInt(
321 transition_type | ui::PAGE_TRANSITION_SERVER_REDIRECT);
322 }
323 histogram_value = events::WEB_NAVIGATION_ON_COMMITTED;
324 event_name = web_navigation::OnCommitted::kEventName;
325 }
326 helpers::DispatchOnCommitted(
327 histogram_value, event_name, web_contents(), render_frame_host,
328 navigation_state_.GetUrl(render_frame_host), transition_type);
329 }
330
331 void WebNavigationTabObserver::DidFailProvisionalLoad(
332 content::RenderFrameHost* render_frame_host,
333 const GURL& validated_url,
334 int error_code,
335 const base::string16& error_description,
336 bool was_ignored_by_handler) {
337 DVLOG(2) << "DidFailProvisionalLoad("
338 << "render_frame_host=" << render_frame_host
339 << ", frame_num=" << render_frame_host->GetRoutingID()
340 << ", url=" << validated_url << ")";
341 if (navigation_state_.CanSendEvents(render_frame_host)) {
342 helpers::DispatchOnErrorOccurred(
343 web_contents(),
344 render_frame_host,
345 navigation_state_.GetUrl(render_frame_host),
346 error_code);
347 }
348 navigation_state_.SetErrorOccurredInFrame(render_frame_host);
349 } 289 }
350 290
351 void WebNavigationTabObserver::DocumentLoadedInFrame( 291 void WebNavigationTabObserver::DocumentLoadedInFrame(
352 content::RenderFrameHost* render_frame_host) { 292 content::RenderFrameHost* render_frame_host) {
353 DVLOG(2) << "DocumentLoadedInFrame("
354 << "render_frame_host=" << render_frame_host
355 << ", frame_num=" << render_frame_host->GetRoutingID() << ")";
356 if (!navigation_state_.CanSendEvents(render_frame_host)) 293 if (!navigation_state_.CanSendEvents(render_frame_host))
357 return; 294 return;
295
358 navigation_state_.SetParsingFinished(render_frame_host); 296 navigation_state_.SetParsingFinished(render_frame_host);
359 helpers::DispatchOnDOMContentLoaded( 297 helpers::DispatchOnDOMContentLoaded(
360 web_contents(), 298 web_contents(),
361 render_frame_host, 299 render_frame_host,
362 navigation_state_.GetUrl(render_frame_host)); 300 navigation_state_.GetUrl(render_frame_host));
363 301
364 if (!navigation_state_.GetNavigationCompleted(render_frame_host)) 302 if (!navigation_state_.GetDocumentLoadCompleted(render_frame_host))
365 return; 303 return;
366 304
367 // The load might already have finished by the time we finished parsing. For 305 // The load might already have finished by the time we finished parsing. For
368 // compatibility reasons, we artifically delay the load completed signal until 306 // compatibility reasons, we artifically delay the load completed signal until
369 // after parsing was completed. 307 // after parsing was completed.
370 helpers::DispatchOnCompleted(web_contents(), 308 helpers::DispatchOnCompleted(web_contents(),
371 render_frame_host, 309 render_frame_host,
372 navigation_state_.GetUrl(render_frame_host)); 310 navigation_state_.GetUrl(render_frame_host));
373 } 311 }
374 312
375 void WebNavigationTabObserver::DidFinishLoad( 313 void WebNavigationTabObserver::DidFinishLoad(
376 content::RenderFrameHost* render_frame_host, 314 content::RenderFrameHost* render_frame_host,
377 const GURL& validated_url) { 315 const GURL& validated_url) {
378 DVLOG(2) << "DidFinishLoad("
379 << "render_frame_host=" << render_frame_host
380 << ", frame_num=" << render_frame_host->GetRoutingID()
381 << ", url=" << validated_url << ")";
382 // When showing replacement content, we might get load signals for frames 316 // When showing replacement content, we might get load signals for frames
383 // that weren't reguarly loaded. 317 // that weren't reguarly loaded.
384 if (!navigation_state_.IsValidFrame(render_frame_host)) 318 if (!navigation_state_.IsValidFrame(render_frame_host))
385 return; 319 return;
386 navigation_state_.SetNavigationCompleted(render_frame_host); 320
321 navigation_state_.SetDocumentLoadCompleted(render_frame_host);
387 if (!navigation_state_.CanSendEvents(render_frame_host)) 322 if (!navigation_state_.CanSendEvents(render_frame_host))
388 return; 323 return;
389 324
390 // A new navigation might have started before the old one completed. 325 // A new navigation might have started before the old one completed.
391 // Ignore the old navigation completion in that case. 326 // Ignore the old navigation completion in that case.
392 // srcdoc iframes will report a url of about:blank, still let it through. 327 // srcdoc iframes will report a url of about:blank, still let it through.
393 if (navigation_state_.GetUrl(render_frame_host) != validated_url && 328 if (navigation_state_.GetUrl(render_frame_host) != validated_url &&
394 (navigation_state_.GetUrl(render_frame_host) != 329 (navigation_state_.GetUrl(render_frame_host) !=
395 GURL(content::kAboutSrcDocURL) || 330 GURL(content::kAboutSrcDocURL) ||
396 validated_url != GURL(url::kAboutBlankURL))) { 331 validated_url != GURL(url::kAboutBlankURL))) {
397 return; 332 return;
398 } 333 }
399 334
400 // The load might already have finished by the time we finished parsing. For 335 // The load might already have finished by the time we finished parsing. For
401 // compatibility reasons, we artifically delay the load completed signal until 336 // compatibility reasons, we artifically delay the load completed signal until
402 // after parsing was completed. 337 // after parsing was completed.
403 if (!navigation_state_.GetParsingFinished(render_frame_host)) 338 if (!navigation_state_.GetParsingFinished(render_frame_host))
404 return; 339 return;
405 helpers::DispatchOnCompleted(web_contents(), 340 helpers::DispatchOnCompleted(web_contents(),
406 render_frame_host, 341 render_frame_host,
407 navigation_state_.GetUrl(render_frame_host)); 342 navigation_state_.GetUrl(render_frame_host));
408 } 343 }
409 344
410 void WebNavigationTabObserver::DidFailLoad( 345 void WebNavigationTabObserver::DidFailLoad(
411 content::RenderFrameHost* render_frame_host, 346 content::RenderFrameHost* render_frame_host,
412 const GURL& validated_url, 347 const GURL& validated_url,
413 int error_code, 348 int error_code,
414 const base::string16& error_description, 349 const base::string16& error_description,
415 bool was_ignored_by_handler) { 350 bool was_ignored_by_handler) {
416 DVLOG(2) << "DidFailLoad("
417 << "render_frame_host=" << render_frame_host
418 << ", frame_num=" << render_frame_host->GetRoutingID()
419 << ", url=" << validated_url << ")";
420 // When showing replacement content, we might get load signals for frames 351 // When showing replacement content, we might get load signals for frames
421 // that weren't reguarly loaded. 352 // that weren't reguarly loaded.
422 if (!navigation_state_.IsValidFrame(render_frame_host)) 353 if (!navigation_state_.IsValidFrame(render_frame_host))
423 return; 354 return;
355
424 if (navigation_state_.CanSendEvents(render_frame_host)) { 356 if (navigation_state_.CanSendEvents(render_frame_host)) {
425 helpers::DispatchOnErrorOccurred( 357 helpers::DispatchOnErrorOccurred(
426 web_contents(), 358 web_contents(),
427 render_frame_host, 359 render_frame_host,
428 navigation_state_.GetUrl(render_frame_host), 360 navigation_state_.GetUrl(render_frame_host),
429 error_code); 361 error_code);
430 } 362 }
431 navigation_state_.SetErrorOccurredInFrame(render_frame_host); 363 navigation_state_.SetErrorOccurredInFrame(render_frame_host);
432 } 364 }
433 365
434 void WebNavigationTabObserver::DidGetRedirectForResourceRequest(
435 content::RenderFrameHost* render_frame_host,
436 const content::ResourceRedirectDetails& details) {
437 if (details.resource_type != content::RESOURCE_TYPE_MAIN_FRAME &&
438 details.resource_type != content::RESOURCE_TYPE_SUB_FRAME) {
439 return;
440 }
441 navigation_state_.SetIsServerRedirected(render_frame_host);
442 }
443
444 void WebNavigationTabObserver::DidOpenRequestedURL( 366 void WebNavigationTabObserver::DidOpenRequestedURL(
445 content::WebContents* new_contents, 367 content::WebContents* new_contents,
446 content::RenderFrameHost* source_render_frame_host, 368 content::RenderFrameHost* source_render_frame_host,
447 const GURL& url, 369 const GURL& url,
448 const content::Referrer& referrer, 370 const content::Referrer& referrer,
449 WindowOpenDisposition disposition, 371 WindowOpenDisposition disposition,
450 ui::PageTransition transition) { 372 ui::PageTransition transition) {
451 if (!navigation_state_.CanSendEvents(source_render_frame_host)) 373 if (!navigation_state_.CanSendEvents(source_render_frame_host))
452 return; 374 return;
453 375
(...skipping 12 matching lines...) Expand all
466 source_render_frame_host, 388 source_render_frame_host,
467 new_contents, 389 new_contents,
468 url); 390 url);
469 } 391 }
470 392
471 void WebNavigationTabObserver::WebContentsDestroyed() { 393 void WebNavigationTabObserver::WebContentsDestroyed() {
472 g_tab_observer.Get().erase(web_contents()); 394 g_tab_observer.Get().erase(web_contents());
473 registrar_.RemoveAll(); 395 registrar_.RemoveAll();
474 } 396 }
475 397
398 void WebNavigationTabObserver::HandleCommit(
399 content::NavigationHandle* navigation_handle) {
400 bool is_reference_fragment_navigation = IsReferenceFragmentNavigation(
401 navigation_handle->GetRenderFrameHost(), navigation_handle->GetURL());
402
403 navigation_state_.StartTrackingDocumentLoad(
404 navigation_handle->GetRenderFrameHost(), navigation_handle->GetURL(),
405 navigation_handle->IsSamePage(),
406 false, // is_error_page
407 navigation_handle->IsSrcdoc());
408
409 events::HistogramValue histogram_value = events::UNKNOWN;
410 std::string event_name;
411 if (is_reference_fragment_navigation) {
412 histogram_value = events::WEB_NAVIGATION_ON_REFERENCE_FRAGMENT_UPDATED;
413 event_name = web_navigation::OnReferenceFragmentUpdated::kEventName;
414 } else if (navigation_handle->IsSamePage()) {
415 histogram_value = events::WEB_NAVIGATION_ON_HISTORY_STATE_UPDATED;
416 event_name = web_navigation::OnHistoryStateUpdated::kEventName;
417 } else {
418 histogram_value = events::WEB_NAVIGATION_ON_COMMITTED;
419 event_name = web_navigation::OnCommitted::kEventName;
420 }
421 helpers::DispatchOnCommitted(histogram_value, event_name, navigation_handle);
422 }
423
424 void WebNavigationTabObserver::HandleError(
425 content::NavigationHandle* navigation_handle) {
426 if (navigation_handle->HasCommitted()) {
427 navigation_state_.StartTrackingDocumentLoad(
428 navigation_handle->GetRenderFrameHost(), navigation_handle->GetURL(),
429 navigation_handle->IsSamePage(),
430 true, // is_error_page
431 navigation_handle->IsSrcdoc());
432 }
433
434 helpers::DispatchOnErrorOccurred(navigation_handle);
435 }
436
476 // See also NavigationController::IsURLInPageNavigation. 437 // See also NavigationController::IsURLInPageNavigation.
477 bool WebNavigationTabObserver::IsReferenceFragmentNavigation( 438 bool WebNavigationTabObserver::IsReferenceFragmentNavigation(
478 content::RenderFrameHost* render_frame_host, 439 content::RenderFrameHost* render_frame_host,
479 const GURL& url) { 440 const GURL& url) {
480 GURL existing_url = navigation_state_.GetUrl(render_frame_host); 441 GURL existing_url = navigation_state_.GetUrl(render_frame_host);
481 if (existing_url == url) 442 if (existing_url == url)
482 return false; 443 return false;
483 444
484 url::Replacements<char> replacements; 445 url::Replacements<char> replacements;
485 replacements.ClearRef(); 446 replacements.ClearRef();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 483
523 GURL frame_url = frame_navigation_state.GetUrl(render_frame_host); 484 GURL frame_url = frame_navigation_state.GetUrl(render_frame_host);
524 if (!frame_navigation_state.IsValidUrl(frame_url)) 485 if (!frame_navigation_state.IsValidUrl(frame_url))
525 return true; 486 return true;
526 487
527 GetFrame::Results::Details frame_details; 488 GetFrame::Results::Details frame_details;
528 frame_details.url = frame_url.spec(); 489 frame_details.url = frame_url.spec();
529 frame_details.error_occurred = 490 frame_details.error_occurred =
530 frame_navigation_state.GetErrorOccurredInFrame(render_frame_host); 491 frame_navigation_state.GetErrorOccurredInFrame(render_frame_host);
531 frame_details.parent_frame_id = 492 frame_details.parent_frame_id =
532 helpers::GetFrameId(render_frame_host->GetParent()); 493 ExtensionApiFrameIdMap::GetFrameId(render_frame_host->GetParent());
533 results_ = GetFrame::Results::Create(frame_details); 494 results_ = GetFrame::Results::Create(frame_details);
534 return true; 495 return true;
535 } 496 }
536 497
537 bool WebNavigationGetAllFramesFunction::RunSync() { 498 bool WebNavigationGetAllFramesFunction::RunSync() {
538 scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_)); 499 scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_));
539 EXTENSION_FUNCTION_VALIDATE(params.get()); 500 EXTENSION_FUNCTION_VALIDATE(params.get());
540 int tab_id = params->details.tab_id; 501 int tab_id = params->details.tab_id;
541 502
542 SetResult(base::Value::CreateNullValue()); 503 SetResult(base::Value::CreateNullValue());
(...skipping 19 matching lines...) Expand all
562 523
563 std::vector<linked_ptr<GetAllFrames::Results::DetailsType> > result_list; 524 std::vector<linked_ptr<GetAllFrames::Results::DetailsType> > result_list;
564 for (FrameNavigationState::const_iterator it = navigation_state.begin(); 525 for (FrameNavigationState::const_iterator it = navigation_state.begin();
565 it != navigation_state.end(); ++it) { 526 it != navigation_state.end(); ++it) {
566 GURL frame_url = navigation_state.GetUrl(*it); 527 GURL frame_url = navigation_state.GetUrl(*it);
567 if (!navigation_state.IsValidUrl(frame_url)) 528 if (!navigation_state.IsValidUrl(frame_url))
568 continue; 529 continue;
569 linked_ptr<GetAllFrames::Results::DetailsType> frame( 530 linked_ptr<GetAllFrames::Results::DetailsType> frame(
570 new GetAllFrames::Results::DetailsType()); 531 new GetAllFrames::Results::DetailsType());
571 frame->url = frame_url.spec(); 532 frame->url = frame_url.spec();
572 frame->frame_id = helpers::GetFrameId(*it); 533 frame->frame_id = ExtensionApiFrameIdMap::GetFrameId(*it);
573 frame->parent_frame_id = helpers::GetFrameId((*it)->GetParent()); 534 frame->parent_frame_id =
535 ExtensionApiFrameIdMap::GetFrameId((*it)->GetParent());
574 frame->process_id = (*it)->GetProcess()->GetID(); 536 frame->process_id = (*it)->GetProcess()->GetID();
575 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(*it); 537 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(*it);
576 result_list.push_back(frame); 538 result_list.push_back(frame);
577 } 539 }
578 results_ = GetAllFrames::Results::Create(result_list); 540 results_ = GetAllFrames::Results::Create(result_list);
579 return true; 541 return true;
580 } 542 }
581 543
582 WebNavigationAPI::WebNavigationAPI(content::BrowserContext* context) 544 WebNavigationAPI::WebNavigationAPI(content::BrowserContext* context)
583 : browser_context_(context) { 545 : browser_context_(context) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 return g_factory.Pointer(); 578 return g_factory.Pointer();
617 } 579 }
618 580
619 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { 581 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) {
620 web_navigation_event_router_.reset(new WebNavigationEventRouter( 582 web_navigation_event_router_.reset(new WebNavigationEventRouter(
621 Profile::FromBrowserContext(browser_context_))); 583 Profile::FromBrowserContext(browser_context_)));
622 EventRouter::Get(browser_context_)->UnregisterObserver(this); 584 EventRouter::Get(browser_context_)->UnregisterObserver(this);
623 } 585 }
624 586
625 } // namespace extensions 587 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698