diff options
Diffstat (limited to 'chrome/browser/chromeos/offline')
3 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc index 42c882a..61dce60 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.cc +++ b/chrome/browser/chromeos/offline/offline_load_page.cc @@ -14,7 +14,6 @@ #include "chrome/browser/chromeos/cros/network_library.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/renderer_host/offline_resource_handler.h" #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_list.h" @@ -49,9 +48,9 @@ namespace chromeos { OfflineLoadPage::OfflineLoadPage(WebContents* web_contents, const GURL& url, - OfflineResourceHandler* handler) + const CompletionCallback& callback) : ChromeInterstitialPage(web_contents, true, url), - handler_(handler), + callback_(callback), proceeded_(false) { net::NetworkChangeNotifier::AddOnlineStateObserver(this); } @@ -166,7 +165,8 @@ void OfflineLoadPage::CommandReceived(const std::string& cmd) { } void OfflineLoadPage::NotifyBlockingPageComplete(bool proceed) { - handler_->OnBlockingPageComplete(proceed); + BrowserThread::PostTask( + BrowserThread::IO, FROM_HERE, base::Bind(callback_, proceed)); } void OfflineLoadPage::Proceed() { diff --git a/chrome/browser/chromeos/offline/offline_load_page.h b/chrome/browser/chromeos/offline/offline_load_page.h index e403949..75bf367 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.h +++ b/chrome/browser/chromeos/offline/offline_load_page.h @@ -8,12 +8,12 @@ #include <string> +#include "base/callback.h" #include "base/compiler_specific.h" #include "chrome/browser/tab_contents/chrome_interstitial_page.h" #include "net/base/network_change_notifier.h" class Extension; -class OfflineResourceHandler; namespace base { class DictionaryValue; @@ -28,9 +28,14 @@ namespace chromeos { class OfflineLoadPage : public ChromeInterstitialPage, public net::NetworkChangeNotifier::OnlineStateObserver { public: - // Create a offline load page for the |web_contents|. + // Passed a boolean indicating whether or not it is OK to proceed with the + // page load. + typedef base::Callback<void(bool /*proceed*/)> CompletionCallback; + + // Create a offline load page for the |web_contents|. The callback will be + // run on the IO thread. OfflineLoadPage(content::WebContents* web_contents, const GURL& url, - OfflineResourceHandler* handler); + const CompletionCallback& callback); protected: virtual ~OfflineLoadPage(); @@ -60,7 +65,7 @@ class OfflineLoadPage : public ChromeInterstitialPage, // has not been activated. bool ShowActivationMessage(); - scoped_refptr<OfflineResourceHandler> handler_; + CompletionCallback callback_; // True if the proceed is chosen. bool proceeded_; diff --git a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc index 3f2c8f6..60472ca 100644 --- a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc +++ b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -26,7 +26,7 @@ class TestOfflineLoadPage : public chromeos::OfflineLoadPage { TestOfflineLoadPage(TabContents* tab_contents, const GURL& url, OfflineLoadPageTest* test_page) - : chromeos::OfflineLoadPage(tab_contents, url, NULL), + : chromeos::OfflineLoadPage(tab_contents, url, CompletionCallback()), test_page_(test_page) { } |
