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

Side by Side Diff: chrome/browser/android/offline_pages/background_loader_offliner.h

Issue 2656763002: [Offline pages] Add navigation error handling to background loader. (Closed)
Patch Set: Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/android/application_status_listener.h" 10 #include "base/android/application_status_listener.h"
(...skipping 25 matching lines...) Expand all
36 36
37 // Offliner implementation. 37 // Offliner implementation.
38 bool LoadAndSave(const SavePageRequest& request, 38 bool LoadAndSave(const SavePageRequest& request,
39 const CompletionCallback& callback) override; 39 const CompletionCallback& callback) override;
40 void Cancel() override; 40 void Cancel() override;
41 41
42 // WebContentsObserver implementation. 42 // WebContentsObserver implementation.
43 void DidStopLoading() override; 43 void DidStopLoading() override;
44 void RenderProcessGone(base::TerminationStatus status) override; 44 void RenderProcessGone(base::TerminationStatus status) override;
45 void WebContentsDestroyed() override; 45 void WebContentsDestroyed() override;
46 void DidFinishNavigation(
47 content::NavigationHandle* navigation_handle) override;
46 48
47 protected: 49 protected:
48 // Called to reset internal loader and observer state. 50 // Called to reset internal loader and observer state.
49 virtual void ResetState(); 51 virtual void ResetState();
50 52
51 private: 53 private:
52 friend class TestBackgroundLoaderOffliner; 54 friend class TestBackgroundLoaderOffliner;
53 55
54 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; 56 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE };
55 57
(...skipping 12 matching lines...) Expand all
68 // Tracks pending request, if any. 70 // Tracks pending request, if any.
69 std::unique_ptr<SavePageRequest> pending_request_; 71 std::unique_ptr<SavePageRequest> pending_request_;
70 // Callback when pending request completes. 72 // Callback when pending request completes.
71 CompletionCallback completion_callback_; 73 CompletionCallback completion_callback_;
72 // ApplicationStatusListener to monitor if Chrome moves to the foreground. 74 // ApplicationStatusListener to monitor if Chrome moves to the foreground.
73 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; 75 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_;
74 // Whether we are on a low-end device. 76 // Whether we are on a low-end device.
75 bool is_low_end_device_; 77 bool is_low_end_device_;
76 // Save state. 78 // Save state.
77 SaveState save_state_; 79 SaveState save_state_;
80 // Error state.
81 bool is_error_;
Dmitry Titov 2017/01/25 19:36:55 naming nit: perhaps it can be more explicit if it
chili 2017/01/31 20:07:37 renamed to page_loading_state_ with enum because t
78 82
79 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; 83 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_;
80 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); 84 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner);
81 }; 85 };
82 86
83 } // namespace offline_pages 87 } // namespace offline_pages
84 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ 88 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698