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

Side by Side Diff: chrome/browser/renderer_host/offline_resource_throttle.cc

Issue 9323071: Use InterstitialPage through a delegate interface instead of deriving from it. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/renderer_host/offline_resource_throttle.h" 5 #include "chrome/browser/renderer_host/offline_resource_throttle.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "chrome/browser/chromeos/offline/offline_load_page.h" 14 #include "chrome/browser/chromeos/offline/offline_load_page.h"
15 #include "chrome/browser/net/chrome_url_request_context.h" 15 #include "chrome/browser/net/chrome_url_request_context.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "content/browser/appcache/chrome_appcache_service.h" 17 #include "content/browser/appcache/chrome_appcache_service.h"
18 #include "content/browser/renderer_host/render_view_host.h" 18 #include "content/browser/renderer_host/render_view_host.h"
19 #include "content/browser/renderer_host/resource_dispatcher_host.h" 19 #include "content/browser/renderer_host/resource_dispatcher_host.h"
20 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h" 20 #include "content/browser/renderer_host/resource_dispatcher_host_request_info.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/render_view_host_delegate.h"
22 #include "content/public/browser/resource_throttle_controller.h" 23 #include "content/public/browser/resource_throttle_controller.h"
23 #include "net/base/net_errors.h" 24 #include "net/base/net_errors.h"
24 #include "net/base/network_change_notifier.h" 25 #include "net/base/network_change_notifier.h"
25 #include "net/url_request/url_request.h" 26 #include "net/url_request/url_request.h"
26 #include "net/url_request/url_request_context.h" 27 #include "net/url_request/url_request_context.h"
27 28
28 using content::BrowserThread; 29 using content::BrowserThread;
29 using content::WebContents; 30 using content::WebContents;
30 31
31 namespace { 32 namespace {
(...skipping 11 matching lines...) Expand all
43 BrowserThread::IO, FROM_HERE, base::Bind(callback, true)); 44 BrowserThread::IO, FROM_HERE, base::Bind(callback, true));
44 } else { 45 } else {
45 RenderViewHost* render_view_host = 46 RenderViewHost* render_view_host =
46 RenderViewHost::FromID(render_process_id, render_view_id); 47 RenderViewHost::FromID(render_process_id, render_view_id);
47 WebContents* web_contents = render_view_host ? 48 WebContents* web_contents = render_view_host ?
48 render_view_host->delegate()->GetAsWebContents() : NULL; 49 render_view_host->delegate()->GetAsWebContents() : NULL;
49 // There is a chance that the tab closed after we decided to show 50 // There is a chance that the tab closed after we decided to show
50 // the offline page on the IO thread and before we actually show the 51 // the offline page on the IO thread and before we actually show the
51 // offline page here on the UI thread. 52 // offline page here on the UI thread.
52 if (web_contents) 53 if (web_contents)
53 (new chromeos::OfflineLoadPage(web_contents, url, callback))->Show(); 54 new chromeos::OfflineLoadPage(web_contents, url, callback);
54 } 55 }
55 } 56 }
56 57
57 } // namespace 58 } // namespace
58 59
59 OfflineResourceThrottle::OfflineResourceThrottle( 60 OfflineResourceThrottle::OfflineResourceThrottle(
60 int render_process_id, 61 int render_process_id,
61 int render_view_id, 62 int render_view_id,
62 net::URLRequest* request, 63 net::URLRequest* request,
63 ChromeAppCacheService* appcache_service) 64 ChromeAppCacheService* appcache_service)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 base::Bind( 129 base::Bind(
129 &ShowOfflinePage, 130 &ShowOfflinePage,
130 render_process_id_, 131 render_process_id_,
131 render_view_id_, 132 render_view_id_,
132 request_->url(), 133 request_->url(),
133 base::Bind( 134 base::Bind(
134 &OfflineResourceThrottle::OnBlockingPageComplete, 135 &OfflineResourceThrottle::OnBlockingPageComplete,
135 AsWeakPtr()))); 136 AsWeakPtr())));
136 } 137 }
137 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698