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

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

Issue 1833053004: [Extensions] Convert APIs to use movable types [10] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc » ('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.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"
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 return true; 513 return true;
514 } 514 }
515 515
516 WebNavigationTabObserver* observer = 516 WebNavigationTabObserver* observer =
517 WebNavigationTabObserver::Get(web_contents); 517 WebNavigationTabObserver::Get(web_contents);
518 DCHECK(observer); 518 DCHECK(observer);
519 519
520 const FrameNavigationState& navigation_state = 520 const FrameNavigationState& navigation_state =
521 observer->frame_navigation_state(); 521 observer->frame_navigation_state();
522 522
523 std::vector<linked_ptr<GetAllFrames::Results::DetailsType> > result_list; 523 std::vector<GetAllFrames::Results::DetailsType> result_list;
524 for (FrameNavigationState::const_iterator it = navigation_state.begin(); 524 for (FrameNavigationState::const_iterator it = navigation_state.begin();
525 it != navigation_state.end(); ++it) { 525 it != navigation_state.end(); ++it) {
526 GURL frame_url = navigation_state.GetUrl(*it); 526 GURL frame_url = navigation_state.GetUrl(*it);
527 if (!navigation_state.IsValidUrl(frame_url)) 527 if (!navigation_state.IsValidUrl(frame_url))
528 continue; 528 continue;
529 linked_ptr<GetAllFrames::Results::DetailsType> frame( 529 GetAllFrames::Results::DetailsType frame;
530 new GetAllFrames::Results::DetailsType()); 530 frame.url = frame_url.spec();
531 frame->url = frame_url.spec(); 531 frame.frame_id = ExtensionApiFrameIdMap::GetFrameId(*it);
532 frame->frame_id = ExtensionApiFrameIdMap::GetFrameId(*it); 532 frame.parent_frame_id =
533 frame->parent_frame_id =
534 ExtensionApiFrameIdMap::GetFrameId((*it)->GetParent()); 533 ExtensionApiFrameIdMap::GetFrameId((*it)->GetParent());
535 frame->process_id = (*it)->GetProcess()->GetID(); 534 frame.process_id = (*it)->GetProcess()->GetID();
536 frame->error_occurred = navigation_state.GetErrorOccurredInFrame(*it); 535 frame.error_occurred = navigation_state.GetErrorOccurredInFrame(*it);
537 result_list.push_back(frame); 536 result_list.push_back(std::move(frame));
538 } 537 }
539 results_ = GetAllFrames::Results::Create(result_list); 538 results_ = GetAllFrames::Results::Create(result_list);
540 return true; 539 return true;
541 } 540 }
542 541
543 WebNavigationAPI::WebNavigationAPI(content::BrowserContext* context) 542 WebNavigationAPI::WebNavigationAPI(content::BrowserContext* context)
544 : browser_context_(context) { 543 : browser_context_(context) {
545 EventRouter* event_router = EventRouter::Get(browser_context_); 544 EventRouter* event_router = EventRouter::Get(browser_context_);
546 event_router->RegisterObserver(this, 545 event_router->RegisterObserver(this,
547 web_navigation::OnBeforeNavigate::kEventName); 546 web_navigation::OnBeforeNavigate::kEventName);
(...skipping 29 matching lines...) Expand all
577 return g_factory.Pointer(); 576 return g_factory.Pointer();
578 } 577 }
579 578
580 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { 579 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) {
581 web_navigation_event_router_.reset(new WebNavigationEventRouter( 580 web_navigation_event_router_.reset(new WebNavigationEventRouter(
582 Profile::FromBrowserContext(browser_context_))); 581 Profile::FromBrowserContext(browser_context_)));
583 EventRouter::Get(browser_context_)->UnregisterObserver(this); 582 EventRouter::Get(browser_context_)->UnregisterObserver(this);
584 } 583 }
585 584
586 } // namespace extensions 585 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/webrtc_audio_private/webrtc_audio_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698