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

Side by Side Diff: headless/public/headless_web_contents.h

Issue 1805983002: headless: Implement client API generation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make PendingMessage moveable 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 #ifndef HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_ 5 #ifndef HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_
6 #define HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_ 6 #define HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "headless/public/headless_export.h" 11 #include "headless/public/headless_export.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace headless { 14 namespace headless {
15 class HeadlessDevToolsTarget;
15 16
16 // Class representing contents of a browser tab. Should be accessed from browser 17 // Class representing contents of a browser tab. Should be accessed from browser
17 // main thread. 18 // main thread.
18 class HEADLESS_EXPORT HeadlessWebContents { 19 class HEADLESS_EXPORT HeadlessWebContents {
19 public: 20 public:
20 virtual ~HeadlessWebContents() {} 21 virtual ~HeadlessWebContents() {}
21 22
22 // TODO(skyostil): Replace this with an equivalent client API. 23 // TODO(skyostil): Replace this with an equivalent client API.
23 class Observer { 24 class Observer {
24 public: 25 public:
25 // All the following notifications will be called on browser main thread. 26 // All the following notifications will be called on browser main thread.
26 virtual void DocumentOnLoadCompletedInMainFrame(){}; 27 virtual void DocumentOnLoadCompletedInMainFrame() {}
27 virtual void DidFinishNavigation(bool success){}; 28 virtual void DidFinishNavigation(bool success) {}
28 29
29 // After this event, this HeadlessWebContents instance is ready to be 30 // Indicates that this HeadlessWebContents instance is now ready to be
30 // controlled using a DevTools client. 31 // inspected using a HeadlessDevToolsClient.
31 virtual void WebContentsReady(){}; 32 virtual void DevToolsTargetReady() {}
32 33
33 protected: 34 protected:
34 Observer() {} 35 Observer() {}
35 virtual ~Observer() {} 36 virtual ~Observer() {}
36 37
37 private: 38 private:
38 DISALLOW_COPY_AND_ASSIGN(Observer); 39 DISALLOW_COPY_AND_ASSIGN(Observer);
39 }; 40 };
40 41
41 // Add or remove an observer to receive events from this WebContents. 42 // Add or remove an observer to receive events from this WebContents.
42 // |observer| must outlive this class or be removed prior to being destroyed. 43 // |observer| must outlive this class or be removed prior to being destroyed.
43 virtual void AddObserver(Observer* observer) = 0; 44 virtual void AddObserver(Observer* observer) = 0;
44 virtual void RemoveObserver(Observer* observer) = 0; 45 virtual void RemoveObserver(Observer* observer) = 0;
45 46
47 // Return a DevTools target corresponding to this tab. Note that this method
48 // won't return a valid value until Observer::DevToolsTargetReady has been
49 // signaled.
50 virtual HeadlessDevToolsTarget* GetDevToolsTarget() = 0;
51
46 private: 52 private:
47 friend class HeadlessWebContentsImpl; 53 friend class HeadlessWebContentsImpl;
48 HeadlessWebContents() {} 54 HeadlessWebContents() {}
49 55
50 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContents); 56 DISALLOW_COPY_AND_ASSIGN(HeadlessWebContents);
51 }; 57 };
52 58
53 } // namespace headless 59 } // namespace headless
54 60
55 #endif // HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_ 61 #endif // HEADLESS_PUBLIC_HEADLESS_WEB_CONTENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698