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

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

Issue 1858403003: headless: Require the user to pass in an initial URL (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/ptr_util.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 13 matching lines...) Expand all
24 namespace headless { 24 namespace headless {
25 25
26 class WebContentsObserverAdapter : public content::WebContentsObserver { 26 class WebContentsObserverAdapter : public content::WebContentsObserver {
27 public: 27 public:
28 WebContentsObserverAdapter(content::WebContents* web_contents, 28 WebContentsObserverAdapter(content::WebContents* web_contents,
29 HeadlessWebContents::Observer* observer) 29 HeadlessWebContents::Observer* observer)
30 : content::WebContentsObserver(web_contents), observer_(observer) {} 30 : content::WebContentsObserver(web_contents), observer_(observer) {}
31 31
32 ~WebContentsObserverAdapter() override {} 32 ~WebContentsObserverAdapter() override {}
33 33
34 void RenderViewReady() override { observer_->WebContentsReady(); }
35
34 void DocumentOnLoadCompletedInMainFrame() override { 36 void DocumentOnLoadCompletedInMainFrame() override {
35 observer_->DocumentOnLoadCompletedInMainFrame(); 37 observer_->DocumentOnLoadCompletedInMainFrame();
36 } 38 }
37 39
38 void DidFinishNavigation( 40 void DidFinishNavigation(
39 content::NavigationHandle* navigation_handle) override { 41 content::NavigationHandle* navigation_handle) override {
40 observer_->DidFinishNavigation(navigation_handle->HasCommitted() && 42 observer_->DidFinishNavigation(navigation_handle->HasCommitted() &&
41 !navigation_handle->IsErrorPage()); 43 !navigation_handle->IsErrorPage());
42 } 44 }
43 45
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 ObserverMap::iterator it = observer_map_.find(observer); 105 ObserverMap::iterator it = observer_map_.find(observer);
104 DCHECK(it != observer_map_.end()); 106 DCHECK(it != observer_map_.end());
105 observer_map_.erase(it); 107 observer_map_.erase(it);
106 } 108 }
107 109
108 content::WebContents* HeadlessWebContentsImpl::web_contents() const { 110 content::WebContents* HeadlessWebContentsImpl::web_contents() const {
109 return web_contents_.get(); 111 return web_contents_.get();
110 } 112 }
111 113
112 } // namespace headless 114 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698