| Index: chrome/browser/chromeos/offline/offline_load_page.cc
|
| ===================================================================
|
| --- chrome/browser/chromeos/offline/offline_load_page.cc (revision 120576)
|
| +++ chrome/browser/chromeos/offline/offline_load_page.cc (working copy)
|
| @@ -14,6 +14,7 @@
|
| #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_preferences_util.h"
|
| #include "chrome/browser/tab_contents/tab_util.h"
|
| #include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/browser_list.h"
|
| @@ -21,6 +22,7 @@
|
| #include "chrome/common/extensions/extension.h"
|
| #include "chrome/common/jstemplate_builder.h"
|
| #include "chrome/common/url_constants.h"
|
| +#include "content/browser/tab_contents/interstitial_page.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/notification_types.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -49,10 +51,13 @@
|
| OfflineLoadPage::OfflineLoadPage(WebContents* web_contents,
|
| const GURL& url,
|
| const CompletionCallback& callback)
|
| - : ChromeInterstitialPage(web_contents, true, url),
|
| - callback_(callback),
|
| - proceeded_(false) {
|
| + : callback_(callback),
|
| + proceeded_(false),
|
| + web_contents_(web_contents),
|
| + url_(url) {
|
| net::NetworkChangeNotifier::AddOnlineStateObserver(this);
|
| + interstitial_page_ = InterstitialPage::Create(web_contents, true, url, this);
|
| + interstitial_page_->Show();
|
| }
|
|
|
| OfflineLoadPage::~OfflineLoadPage() {
|
| @@ -76,20 +81,21 @@
|
| bool rtl = base::i18n::IsRTL();
|
| strings.SetString("textdirection", rtl ? "rtl" : "ltr");
|
|
|
| - string16 failed_url(ASCIIToUTF16(url().spec()));
|
| + string16 failed_url(ASCIIToUTF16(url_.spec()));
|
| if (rtl)
|
| base::i18n::WrapStringWithLTRFormatting(&failed_url);
|
| strings.SetString("url", failed_url);
|
|
|
| // The offline page for app has icons and slightly different message.
|
| - Profile* profile = Profile::FromBrowserContext(tab()->GetBrowserContext());
|
| + Profile* profile = Profile::FromBrowserContext(
|
| + web_contents_->GetBrowserContext());
|
| DCHECK(profile);
|
| const Extension* extension = NULL;
|
| ExtensionService* extensions_service = profile->GetExtensionService();
|
| // Extension service does not exist in test.
|
| if (extensions_service)
|
| extension = extensions_service->extensions()->GetHostedAppByURL(
|
| - ExtensionURLInfo(url()));
|
| + ExtensionURLInfo(url_));
|
|
|
| if (extension)
|
| GetAppOfflineStrings(extension, failed_url, &strings);
|
| @@ -102,6 +108,13 @@
|
| return jstemplate_builder::GetI18nTemplateHtml(html, &strings);
|
| }
|
|
|
| + void OfflineLoadPage::OverrideRendererPrefs(
|
| + content::RendererPreferences* prefs) {
|
| + Profile* profile = Profile::FromBrowserContext(
|
| + web_contents_->GetBrowserContext());
|
| + renderer_preferences_util::UpdateFromSystemSettings(prefs, profile);
|
| + }
|
| +
|
| void OfflineLoadPage::GetAppOfflineStrings(
|
| const Extension* app,
|
| const string16& failed_url,
|
| @@ -128,7 +141,7 @@
|
|
|
| void OfflineLoadPage::GetNormalOfflineStrings(
|
| const string16& failed_url, DictionaryValue* strings) const {
|
| - strings->SetString("title", tab()->GetTitle());
|
| + strings->SetString("title", web_contents_->GetTitle());
|
|
|
| // No icon for normal web site.
|
| strings->SetString("display_icon", "none");
|
| @@ -173,7 +186,7 @@
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| proceeded_ = true;
|
| NotifyBlockingPageComplete(true);
|
| - InterstitialPage::Proceed();
|
| + interstitial_page_->Proceed();
|
| }
|
|
|
| void OfflineLoadPage::DontProceed() {
|
| @@ -182,7 +195,7 @@
|
| if (proceeded_)
|
| return;
|
| NotifyBlockingPageComplete(false);
|
| - InterstitialPage::DontProceed();
|
| + interstitial_page_->DontProceed();
|
| }
|
|
|
| void OfflineLoadPage::OnOnlineStateChanged(bool online) {
|
|
|