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

Side by Side Diff: headless/lib/browser/headless_browser_impl.h

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 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ 5 #ifndef HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_
6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ 6 #define HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_
7 7
8 #include "headless/public/headless_browser.h" 8 #include "headless/public/headless_browser.h"
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include <memory>
11
11 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
12 #include "headless/lib/browser/headless_web_contents_impl.h" 13 #include "headless/lib/browser/headless_web_contents_impl.h"
13 14
14 namespace aura { 15 namespace aura {
15 class WindowTreeHost; 16 class WindowTreeHost;
16 } 17 }
17 18
18 namespace headless { 19 namespace headless {
19 20
20 class HeadlessBrowserContext; 21 class HeadlessBrowserContext;
21 class HeadlessBrowserMainParts; 22 class HeadlessBrowserMainParts;
22 23
23 class HeadlessBrowserImpl : public HeadlessBrowser { 24 class HeadlessBrowserImpl : public HeadlessBrowser {
24 public: 25 public:
25 HeadlessBrowserImpl( 26 HeadlessBrowserImpl(
26 const base::Callback<void(HeadlessBrowser*)>& on_start_callback, 27 const base::Callback<void(HeadlessBrowser*)>& on_start_callback,
27 const HeadlessBrowser::Options& options); 28 const HeadlessBrowser::Options& options);
28 ~HeadlessBrowserImpl() override; 29 ~HeadlessBrowserImpl() override;
29 30
30 // HeadlessBrowser implementation: 31 // HeadlessBrowser implementation:
31 scoped_ptr<HeadlessWebContents> CreateWebContents( 32 std::unique_ptr<HeadlessWebContents> CreateWebContents(
32 const gfx::Size& size) override; 33 const gfx::Size& size) override;
33 scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread() 34 scoped_refptr<base::SingleThreadTaskRunner> BrowserMainThread()
34 const override; 35 const override;
35 36
36 void Shutdown() override; 37 void Shutdown() override;
37 38
38 void set_browser_main_parts(HeadlessBrowserMainParts* browser_main_parts); 39 void set_browser_main_parts(HeadlessBrowserMainParts* browser_main_parts);
39 HeadlessBrowserMainParts* browser_main_parts() const; 40 HeadlessBrowserMainParts* browser_main_parts() const;
40 41
41 HeadlessBrowserContext* browser_context() const; 42 HeadlessBrowserContext* browser_context() const;
42 43
43 void RunOnStartCallback(); 44 void RunOnStartCallback();
44 45
45 const HeadlessBrowser::Options& options() const { return options_; } 46 const HeadlessBrowser::Options& options() const { return options_; }
46 47
47 // Customize the options used by this headless browser instance. Note that 48 // Customize the options used by this headless browser instance. Note that
48 // options which take effect before the message loop has been started (e.g., 49 // options which take effect before the message loop has been started (e.g.,
49 // custom message pumps) cannot be set via this method. 50 // custom message pumps) cannot be set via this method.
50 void SetOptionsForTesting(const HeadlessBrowser::Options& options); 51 void SetOptionsForTesting(const HeadlessBrowser::Options& options);
51 52
52 protected: 53 protected:
53 base::Callback<void(HeadlessBrowser*)> on_start_callback_; 54 base::Callback<void(HeadlessBrowser*)> on_start_callback_;
54 HeadlessBrowser::Options options_; 55 HeadlessBrowser::Options options_;
55 HeadlessBrowserMainParts* browser_main_parts_; // Not owned. 56 HeadlessBrowserMainParts* browser_main_parts_; // Not owned.
56 scoped_ptr<aura::WindowTreeHost> window_tree_host_; 57 std::unique_ptr<aura::WindowTreeHost> window_tree_host_;
57 58
58 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserImpl); 59 DISALLOW_COPY_AND_ASSIGN(HeadlessBrowserImpl);
59 }; 60 };
60 61
61 } // namespace headless 62 } // namespace headless
62 63
63 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_ 64 #endif // HEADLESS_LIB_BROWSER_HEADLESS_BROWSER_IMPL_H_
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_browser_context.cc ('k') | headless/lib/browser/headless_browser_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698