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

Unified Diff: chrome/renderer/net/error_cache_load.cc

Issue 207553008: Surface button for loading stale cache copy on net error page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix incorrect spelling of iOS. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/net/error_cache_load.cc
diff --git a/chrome/renderer/net/error_cache_load.cc b/chrome/renderer/net/error_cache_load.cc
deleted file mode 100644
index e866917e04657f4d6ffdb1071e1432f8bfafba19..0000000000000000000000000000000000000000
--- a/chrome/renderer/net/error_cache_load.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "error_cache_load.h"
-
-#include "content/public/renderer/render_frame.h"
-#include "gin/handle.h"
-#include "gin/object_template_builder.h"
-#include "third_party/WebKit/public/platform/WebURLRequest.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
-#include "third_party/WebKit/public/web/WebKit.h"
-
-gin::WrapperInfo ErrorCacheLoad::kWrapperInfo = {gin::kEmbedderNativeGin};
-
-// static
-void ErrorCacheLoad::Install(content::RenderFrame* render_frame,
- const GURL& page_url) {
- v8::Isolate* isolate = blink::mainThreadIsolate();
- v8::HandleScope handle_scope(isolate);
- v8::Handle<v8::Context> context =
- render_frame->GetWebFrame()->mainWorldScriptContext();
- if (context.IsEmpty())
- return;
-
- v8::Context::Scope context_scope(context);
-
- gin::Handle<ErrorCacheLoad> controller =
- gin::CreateHandle(isolate, new ErrorCacheLoad(render_frame, page_url));
- v8::Handle<v8::Object> global = context->Global();
- global->Set(gin::StringToV8(isolate, "errorCacheLoad"), controller.ToV8());
-}
-
-bool ErrorCacheLoad::ReloadStaleInstance() {
- if (!render_frame_)
- return false;
-
- blink::WebURLRequest request(page_url_);
- request.setCachePolicy(blink::WebURLRequest::ReturnCacheDataDontLoad);
-
- render_frame_->GetWebFrame()->loadRequest(request);
-
- return true;
-}
-
-ErrorCacheLoad::ErrorCacheLoad(content::RenderFrame* render_frame,
- const GURL& page_url)
- : RenderFrameObserver(render_frame),
- render_frame_(render_frame),
- page_url_(page_url) {}
-
-ErrorCacheLoad::~ErrorCacheLoad() {}
-
-gin::ObjectTemplateBuilder ErrorCacheLoad::GetObjectTemplateBuilder(
- v8::Isolate* isolate) {
- return gin::Wrappable<ErrorCacheLoad>::GetObjectTemplateBuilder(isolate)
- .SetMethod("reloadStaleInstance", &ErrorCacheLoad::ReloadStaleInstance);
-}
-
-void ErrorCacheLoad::OnDestruct() { render_frame_ = NULL; }

Powered by Google App Engine
This is Rietveld 408576698