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

Side by Side Diff: components/background_loader/background_loader_contents.h

Issue 2393353002: [Background loader] .h file draft outline of background loader (Closed)
Patch Set: some adjustments Created 4 years, 2 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
« no previous file with comments | « components/background_loader/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
fgorski 2016/10/13 22:32:51 drop the (c) it's not required.
chili 2016/10/24 23:56:41 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_BACKGROUND_LOADER_BACKGROUND_LOADER_CONTENTS_H_
6 #define COMPONENTS_BACKGROUND_LOADER_BACKGROUND_LOADER_CONTENTS_H_
fgorski 2016/10/13 22:32:51 About location of that file (from the meeting disc
chili 2016/10/24 23:56:41 Done.
7
8 #include <string>
9
10 #include "base/callback.h"
11 #include "content/public/browser/web_contents.h"
12 #include "content/public/browser/web_contents_delegate.h"
13 #include "content/public/browser/web_contents_observer.h"
14 #include "url/gurl.h"
15
16 namespace background {
17
18 // This class maintains a WebContents used in the background. It can host
19 // a renderer but does not have any visible display.
20 class BackgroundLoaderContents : public content::WebContentsDelegate,
21 public content::WebContentsObserver {
22 public:
23 // Nested observer class for listening to events.
24 class Observer {
25 public:
26 Observer() {}
Dmitry Titov 2016/10/13 01:03:26 no need to have constructor, usually the Observers
chili 2016/10/13 01:18:58 I'm not too familiar about this part of C++. I wa
dougarnett 2016/10/13 15:38:04 So at least remove ctor here and define dtor as vi
chili 2016/10/24 23:56:42 Removed Observer altogether in favor of plain WebC
27 ~Observer() {}
28 void OnPageLoadStarted() {}
29 void OnPageLoaded() {}
Dmitry Titov 2016/10/13 01:03:26 Will this correspond to OnLoad event or to some si
chili 2016/10/13 01:18:58 This will correspond to the OnLoad event from the
dougarnett 2016/10/13 15:38:04 Might be helpful to mention in the class comment t
chili 2016/10/24 23:56:41 Acknowledged.
30 };
31
32 BackgroundLoaderContents(
Dmitry Titov 2016/10/13 01:03:26 Needs comment explaining the parameters (eg why pa
chili 2016/10/24 23:56:41 Done.
33 content::BrowserContext* browser_context,
34 content::SessionStorageNamespace* session_storage_namespace);
35 BackgroundLoaderContents(content::BrowserContext* browser_context);
36 ~BackgroundLoaderContents() override;
37
38 content::WebContents* web_contents() const { return web_contents_.get(); }
Dmitry Titov 2016/10/13 01:03:26 I'm still not sure this should be exposed. WebCont
chili 2016/10/24 23:56:42 removed
39 void LoadPage(const GURL& url);
40 void StopLoading();
Dmitry Titov 2016/10/13 01:03:26 If StopLoading() is called, what call will Observe
chili 2016/10/24 23:56:42 Renamed to Cancel, per design doc. This will call
41 void SetObserver(Observer* observer);
Dmitry Titov 2016/10/13 01:03:26 These usually follow patter on AddObserver/RemoveO
chili 2016/10/13 01:18:58 I had a TODO comment somewhere for whether this sh
42
43 // content::WebContentsDelegate Implementation:
44 void CloseContents(content::WebContents* source) override;
45 bool ShouldSuppressDialogs(content::WebContents* source) override;
46 bool IsNeverVisible(content::WebContents* web_contents) override;
47 bool ShouldFocusLocationBarByDefault(content::WebContents* source) override;
48 bool ShouldFocusPageAfterCrash() override;
49 void CanDownload(const GURL& url,
50 const std::string& request_method,
51 const base::Callback<void(bool)>& callback) override;
52 bool ShouldCreateWebContents(
53 content::WebContents* contents,
54 int32_t route_id,
55 int32_t main_frame_route_id,
56 int32_t main_frame_widget_route_id,
57 WindowContainerType window_container_type,
58 const std::string& frame_name,
59 const GURL& target_url,
60 const std::string& partition_id,
61 content::SessionStorageNamespace* session_storage_namespace) override;
62 void RequestMediaAccessPermission(
63 content::WebContents* contents,
64 const content::MediaStreamRequest& request,
65 const content::MediaResponseCallback& callback) override;
66 bool CheckMediaAccessPermission(content::WebContents* contents,
67 const GURL& security_origin,
68 content::MediaStreamType type) override;
69
70 // content::WebContentsObserver Implementation:
71 void RenderProcessGone(base::TerminationStatus status) override;
72 void DidStartLoading() override;
73 void DidStopLoading() override;
74
75 protected:
76 BackgroundLoaderContents();
fgorski 2016/10/13 22:32:51 Hey, I don't understand that part. Why is this pro
chili 2016/10/24 23:56:41 Removed
77
78 private:
79 std::unique_ptr<content::WebContents> web_contents_;
80 content::SessionStorageNamespaceMap session_storage_namespace_map_;
81 content::BrowserContext* browser_context_;
82 Observer* observer_;
83
84 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderContents);
85 };
86
87 } // namespace background
88 #endif // COMPONENTS_BACKGROUND_LOADER_BACKGROUND_LOADER_CONTENTS_H_
OLDNEW
« no previous file with comments | « components/background_loader/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698