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

Side by Side Diff: headless/lib/browser/headless_web_contents_impl.cc

Issue 1854043002: convert //headless to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "headless/lib/browser/headless_web_contents_impl.h" 5 #include "headless/lib/browser/headless_web_contents_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
9 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
10 #include "content/public/browser/navigation_handle.h" 11 #include "content/public/browser/navigation_handle.h"
11 #include "content/public/browser/render_frame_host.h" 12 #include "content/public/browser/render_frame_host.h"
12 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
13 #include "content/public/browser/render_view_host.h" 14 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/render_widget_host_view.h" 15 #include "content/public/browser/render_widget_host_view.h"
15 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
16 #include "content/public/browser/web_contents_delegate.h" 17 #include "content/public/browser/web_contents_delegate.h"
17 #include "content/public/browser/web_contents_observer.h" 18 #include "content/public/browser/web_contents_observer.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 content::NavigationController::LoadURLParams params(url); 88 content::NavigationController::LoadURLParams params(url);
88 params.transition_type = ui::PageTransitionFromInt( 89 params.transition_type = ui::PageTransitionFromInt(
89 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); 90 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
90 web_contents_->GetController().LoadURLWithParams(params); 91 web_contents_->GetController().LoadURLWithParams(params);
91 web_contents_->Focus(); 92 web_contents_->Focus();
92 return true; 93 return true;
93 } 94 }
94 95
95 void HeadlessWebContentsImpl::AddObserver(Observer* observer) { 96 void HeadlessWebContentsImpl::AddObserver(Observer* observer) {
96 DCHECK(observer_map_.find(observer) == observer_map_.end()); 97 DCHECK(observer_map_.find(observer) == observer_map_.end());
97 observer_map_[observer] = make_scoped_ptr( 98 observer_map_[observer] = base::WrapUnique(
98 new WebContentsObserverAdapter(web_contents_.get(), observer)); 99 new WebContentsObserverAdapter(web_contents_.get(), observer));
99 } 100 }
100 101
101 void HeadlessWebContentsImpl::RemoveObserver(Observer* observer) { 102 void HeadlessWebContentsImpl::RemoveObserver(Observer* observer) {
102 ObserverMap::iterator it = observer_map_.find(observer); 103 ObserverMap::iterator it = observer_map_.find(observer);
103 DCHECK(it != observer_map_.end()); 104 DCHECK(it != observer_map_.end());
104 observer_map_.erase(it); 105 observer_map_.erase(it);
105 } 106 }
106 107
107 content::WebContents* HeadlessWebContentsImpl::web_contents() const { 108 content::WebContents* HeadlessWebContentsImpl::web_contents() const {
108 return web_contents_.get(); 109 return web_contents_.get();
109 } 110 }
110 111
111 } // namespace headless 112 } // namespace headless
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.h ('k') | headless/lib/headless_browser_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698