Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_RENDERER_NET_ERROR_CACHE_LOAD_H_ | 5 #ifndef CHROME_RENDERER_NET_ERROR_PAGE_HELPER_FUNCTIONS_H_ |
| 6 #define CHROME_RENDERER_NET_ERROR_CACHE_LOAD_H_ | 6 #define CHROME_RENDERER_NET_ERROR_PAGE_HELPER_FUNCTIONS_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "content/public/renderer/render_frame_observer.h" | 9 #include "content/public/renderer/render_frame_observer.h" |
| 10 #include "gin/wrappable.h" | 10 #include "gin/wrappable.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 // ErrorCacheLoad class: | 13 // ErrorPageHelperFunctions class: |
| 14 // | 14 // |
| 15 // This class makes cache loading operations available to the | 15 // This class makes cache loading operations available to the |
| 16 // error page loaded by NetErrorHelper. It is bound to the javascript | 16 // error page loaded by NetErrorHelper. It is bound to the javascript |
| 17 // window.errorCacheLoad object. | 17 // window.errorCacheLoad object. |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class RenderFrame; | 22 class RenderFrame; |
| 23 } | 23 } |
| 24 | 24 |
| 25 class ErrorCacheLoad : public gin::Wrappable<ErrorCacheLoad>, | 25 class ErrorPageHelperFunctions |
|
mmenke
2014/04/09 15:59:26
Think NetErrorHelperFunctions to be more consisten
mmenke
2014/04/09 15:59:26
Think this is worth a comment (Error pages functio
Randy Smith (Not in Mondays)
2014/04/10 21:51:01
Done.
Randy Smith (Not in Mondays)
2014/04/10 21:51:01
Done.
| |
| 26 public content::RenderFrameObserver { | 26 : public gin::Wrappable<ErrorPageHelperFunctions>, |
| 27 public content::RenderFrameObserver { | |
| 27 public: | 28 public: |
| 28 static gin::WrapperInfo kWrapperInfo; | 29 static gin::WrapperInfo kWrapperInfo; |
| 29 | 30 |
| 30 static void Install(content::RenderFrame* render_frame, const GURL& page_url); | 31 static void Install(content::RenderFrame* render_frame, const GURL& page_url); |
| 31 | 32 |
| 32 private: | 33 private: |
| 33 ErrorCacheLoad(content::RenderFrame* render_frame, const GURL& page_url); | 34 ErrorPageHelperFunctions(content::RenderFrame* render_frame, |
| 34 virtual ~ErrorCacheLoad(); | 35 const GURL& page_url); |
| 36 virtual ~ErrorPageHelperFunctions(); | |
| 35 | 37 |
| 36 // Loads the original URL associated with the frame, with the blink | 38 // Execute a "Load Stale" button click. |
| 37 // ReturnCacheDataDontLoad flag set to make sure that the value is | 39 bool LoadStaleButtonClick(); |
| 38 // only gotten from cache. | 40 |
| 39 bool ReloadStaleInstance(); | 41 // Execute a "Reload" button click. |
| 42 bool ReloadButtonClick(); | |
| 43 | |
| 44 // Execute a "More" button click. | |
| 45 bool MoreButtonClick(); | |
| 40 | 46 |
| 41 // gin::WrappableBase | 47 // gin::WrappableBase |
| 42 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 48 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
| 43 v8::Isolate* isolate) OVERRIDE; | 49 v8::Isolate* isolate) OVERRIDE; |
| 44 | 50 |
| 45 // RenderFrameObserver. Overridden to avoid being destroyed when RenderFrame | 51 // RenderFrameObserver. Overridden to avoid being destroyed when RenderFrame |
| 46 // goes away; ErrorCacheLoad objects are owned by the JS garbage collector. | 52 // goes away; ErrorPageHelperFunctions objects are owned by the JS |
| 53 // garbage collector. | |
| 47 virtual void OnDestruct() OVERRIDE; | 54 virtual void OnDestruct() OVERRIDE; |
| 48 | 55 |
| 49 // We'll be torn down by V8 when the page goes away, so it's safe to hold | 56 // We'll be torn down by V8 when the page goes away, so it's safe to hold |
| 50 // a naked pointer to the render frame. | 57 // a naked pointer to the render frame. |
| 51 content::RenderFrame* render_frame_; | 58 content::RenderFrame* render_frame_; |
|
mmenke
2014/04/09 15:59:26
Don't need our own render_frame_: render_frame()
Randy Smith (Not in Mondays)
2014/04/10 21:51:01
Done.
| |
| 52 | 59 |
| 53 const GURL page_url_; | 60 const GURL page_url_; |
|
mmenke
2014/04/09 15:59:26
Doesn't seem to be needed.
Randy Smith (Not in Mondays)
2014/04/10 21:51:01
Good catch. Done.
| |
| 54 | 61 |
| 55 bool render_frame_destroyed_; | 62 bool render_frame_destroyed_; |
|
mmenke
2014/04/09 15:59:26
Not used.
Randy Smith (Not in Mondays)
2014/04/10 21:51:01
Done.
| |
| 56 | 63 |
| 57 DISALLOW_COPY_AND_ASSIGN(ErrorCacheLoad); | 64 DISALLOW_COPY_AND_ASSIGN(ErrorPageHelperFunctions); |
| 58 }; | 65 }; |
| 59 | 66 |
| 60 #endif // CHROME_RENDERER_NET_ERROR_CACHE_LOAD_H_ | 67 #endif // CHROME_RENDERER_NET_ERROR_PAGE_HELPER_FUNCTIONS_H_ |
| OLD | NEW |