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

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

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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"
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 if (existing_url == url) 441 if (existing_url == url)
442 return false; 442 return false;
443 443
444 url::Replacements<char> replacements; 444 url::Replacements<char> replacements;
445 replacements.ClearRef(); 445 replacements.ClearRef();
446 return existing_url.ReplaceComponents(replacements) == 446 return existing_url.ReplaceComponents(replacements) ==
447 url.ReplaceComponents(replacements); 447 url.ReplaceComponents(replacements);
448 } 448 }
449 449
450 bool WebNavigationGetFrameFunction::RunSync() { 450 bool WebNavigationGetFrameFunction::RunSync() {
451 scoped_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_)); 451 std::unique_ptr<GetFrame::Params> params(GetFrame::Params::Create(*args_));
452 EXTENSION_FUNCTION_VALIDATE(params.get()); 452 EXTENSION_FUNCTION_VALIDATE(params.get());
453 int tab_id = params->details.tab_id; 453 int tab_id = params->details.tab_id;
454 int frame_id = params->details.frame_id; 454 int frame_id = params->details.frame_id;
455 455
456 SetResult(base::Value::CreateNullValue()); 456 SetResult(base::Value::CreateNullValue());
457 457
458 content::WebContents* web_contents; 458 content::WebContents* web_contents;
459 if (!ExtensionTabUtil::GetTabById(tab_id, 459 if (!ExtensionTabUtil::GetTabById(tab_id,
460 GetProfile(), 460 GetProfile(),
461 include_incognito(), 461 include_incognito(),
(...skipping 26 matching lines...) Expand all
488 frame_details.url = frame_url.spec(); 488 frame_details.url = frame_url.spec();
489 frame_details.error_occurred = 489 frame_details.error_occurred =
490 frame_navigation_state.GetErrorOccurredInFrame(render_frame_host); 490 frame_navigation_state.GetErrorOccurredInFrame(render_frame_host);
491 frame_details.parent_frame_id = 491 frame_details.parent_frame_id =
492 ExtensionApiFrameIdMap::GetFrameId(render_frame_host->GetParent()); 492 ExtensionApiFrameIdMap::GetFrameId(render_frame_host->GetParent());
493 results_ = GetFrame::Results::Create(frame_details); 493 results_ = GetFrame::Results::Create(frame_details);
494 return true; 494 return true;
495 } 495 }
496 496
497 bool WebNavigationGetAllFramesFunction::RunSync() { 497 bool WebNavigationGetAllFramesFunction::RunSync() {
498 scoped_ptr<GetAllFrames::Params> params(GetAllFrames::Params::Create(*args_)); 498 std::unique_ptr<GetAllFrames::Params> params(
499 GetAllFrames::Params::Create(*args_));
499 EXTENSION_FUNCTION_VALIDATE(params.get()); 500 EXTENSION_FUNCTION_VALIDATE(params.get());
500 int tab_id = params->details.tab_id; 501 int tab_id = params->details.tab_id;
501 502
502 SetResult(base::Value::CreateNullValue()); 503 SetResult(base::Value::CreateNullValue());
503 504
504 content::WebContents* web_contents; 505 content::WebContents* web_contents;
505 if (!ExtensionTabUtil::GetTabById(tab_id, 506 if (!ExtensionTabUtil::GetTabById(tab_id,
506 GetProfile(), 507 GetProfile(),
507 include_incognito(), 508 include_incognito(),
508 NULL, 509 NULL,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 return g_factory.Pointer(); 577 return g_factory.Pointer();
577 } 578 }
578 579
579 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { 580 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) {
580 web_navigation_event_router_.reset(new WebNavigationEventRouter( 581 web_navigation_event_router_.reset(new WebNavigationEventRouter(
581 Profile::FromBrowserContext(browser_context_))); 582 Profile::FromBrowserContext(browser_context_)));
582 EventRouter::Get(browser_context_)->UnregisterObserver(this); 583 EventRouter::Get(browser_context_)->UnregisterObserver(this);
583 } 584 }
584 585
585 } // namespace extensions 586 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698