summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/generated_resources.grd22
-rw-r--r--chrome/browser/chromeos/offline/offline_load_page.cc37
-rw-r--r--chrome/browser/chromeos/offline/offline_load_page.h4
-rw-r--r--chrome/browser/renderer_host/offline_resource_handler.cc12
-rw-r--r--chrome/browser/renderer_host/offline_resource_handler.h3
-rw-r--r--chrome/browser/resources/activate_broadband_info.pngbin0 -> 1751 bytes
-rw-r--r--chrome/browser/resources/offline_load.html141
7 files changed, 147 insertions, 72 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 929c73d..6dbf1e3 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -7791,24 +7791,28 @@ Keep your key file in a safe place. You will need it to create new versions of y
<!-- Offline page -->
<if expr="pp_ifdef('chromeos')">
<message name="IDS_OFFLINE_LOAD_HEADLINE" desc="Offline Page HTML headline">
- Your device is offline.
+ Your device is offline
</message>
<message name="IDS_SITE_OFFLINE_LOAD_DESCRIPTION" desc="offline site">
The webpage at <ph name="HOST_NAME">&lt;strong&gt;$1<ex>www.offline.com</ex>&lt;/strong&gt;</ph> cannot be reached because your network connection is down. The page will be loaded when the network connection is restored. &lt;br&gt;
- Try reconnecting, connecting to another network or proceeding with loading anyway.
</message>
<message name="IDS_APP_OFFLINE_LOAD_DESCRIPTION" desc="offline app">
The app at <ph name="HOST_NAME">&lt;strong&gt;$1<ex>www.offline.com</ex>&lt;/strong&gt;</ph> cannot be reached because your network connection is down. The page will be loaded when the network connection is restored. &lt;br&gt;
- Try reconnecting, connecting to another network or proceeding with loading anyway.
</message>
- <message name="IDS_OFFLINE_LOAD_BUTTON">
- Load Anyway
- </message>
- <message name="IDS_OFFLINE_CANCEL_BUTTON">
- Cancel
+ <message name="IDS_OFFLINE_TRY_LOADING">
+ Try loading the page anyway
</message>
<message name="IDS_OFFLINE_NETWORK_SETTINGS">
- Network Settings ...
+ Network settings
+ </message>
+ <message name="IDS_OFFLINE_ACTIVATION_HEADLINE">
+ Free Data from Verizon Wireless
+ </message>
+ <message name="IDS_OFFLINE_ACTIVATION_MESSAGE">
+ As a Cr-48 pilot user you get 100MB free from Verizon Wireless every 30 days for 2 years. Just sign up and you're online!
+ </message>
+ <message name="IDS_OFFLINE_ACTIVATION_BUTTON">
+ Connect to Verizon Wireless
</message>
</if>
diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc
index e9457b8..5e95496 100644
--- a/chrome/browser/chromeos/offline/offline_load_page.cc
+++ b/chrome/browser/chromeos/offline/offline_load_page.cc
@@ -15,6 +15,8 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_util.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/chromeos/cros/cros_library.h"
+#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/notification_service.h"
@@ -75,10 +77,6 @@ OfflineLoadPage::OfflineLoadPage(TabContents* tab_contents,
std::string OfflineLoadPage::GetHTMLContents() {
DictionaryValue strings;
- // Toggle Cancel button.
- strings.SetString("display_cancel",
- tab()->controller().CanGoBack() ? "inline" : "none");
-
int64 time_to_wait = std::max(
static_cast<int64>(0),
kMaxBlankPeriod -
@@ -86,12 +84,17 @@ std::string OfflineLoadPage::GetHTMLContents() {
// Set the timeout to show the page.
strings.SetInteger("timeToWait", static_cast<int>(time_to_wait));
// Button labels
- SetString(&strings, "load_button", IDS_OFFLINE_LOAD_BUTTON);
- SetString(&strings, "cancel_button", IDS_OFFLINE_CANCEL_BUTTON);
-
SetString(&strings, "heading", IDS_OFFLINE_LOAD_HEADLINE);
+ SetString(&strings, "try_loading", IDS_OFFLINE_TRY_LOADING);
SetString(&strings, "network_settings", IDS_OFFLINE_NETWORK_SETTINGS);
+ // Activation
+ SetString(&strings, "activation_heading", IDS_OFFLINE_ACTIVATION_HEADLINE);
+ SetString(&strings, "activation_msg", IDS_OFFLINE_ACTIVATION_MESSAGE);
+ SetString(&strings, "activation_button", IDS_OFFLINE_ACTIVATION_BUTTON);
+ strings.SetString("display_activation",
+ ShowActivationMessage() ? "block" : "none");
+
bool rtl = base::i18n::IsRTL();
strings.SetString("textdirection", rtl ? "rtl" : "ltr");
@@ -173,6 +176,10 @@ void OfflineLoadPage::CommandReceived(const std::string& cmd) {
Browser* browser = BrowserList::GetLastActive();
DCHECK(browser);
browser->ShowOptionsTab(chrome::kInternetOptionsSubPage);
+ } else if (command == "open_activate_broadband") {
+ Browser* browser = BrowserList::GetLastActive();
+ DCHECK(browser);
+ browser->OpenMobilePlanTabAndActivate();
} else {
LOG(WARNING) << "Unknown command:" << cmd;
}
@@ -212,4 +219,20 @@ void OfflineLoadPage::Observe(NotificationType type,
}
}
+bool OfflineLoadPage::ShowActivationMessage() {
+ CrosLibrary* cros = CrosLibrary::Get();
+ if (!cros || !cros->GetNetworkLibrary()->cellular_available())
+ return false;
+
+ const CellularNetworkVector& cell_networks =
+ cros->GetNetworkLibrary()->cellular_networks();
+ for (size_t i = 0; i < cell_networks.size(); ++i) {
+ chromeos::ActivationState activation_state =
+ cell_networks[i]->activation_state();
+ if (activation_state == ACTIVATION_STATE_ACTIVATED)
+ return false;
+ }
+ return true;
+}
+
} // namespace chromeos
diff --git a/chrome/browser/chromeos/offline/offline_load_page.h b/chrome/browser/chromeos/offline/offline_load_page.h
index 1223a52..bf70d4d 100644
--- a/chrome/browser/chromeos/offline/offline_load_page.h
+++ b/chrome/browser/chromeos/offline/offline_load_page.h
@@ -73,6 +73,10 @@ class OfflineLoadPage : public InterstitialPage {
void GetNormalOfflineStrings(const string16& faield_url,
DictionaryValue* strings) const;
+ // True if there is a mobile network is available but
+ // has not been activated.
+ bool ShowActivationMessage();
+
Delegate* delegate_;
NotificationRegistrar registrar_;
diff --git a/chrome/browser/renderer_host/offline_resource_handler.cc b/chrome/browser/renderer_host/offline_resource_handler.cc
index 19f5aee..f7e13d3 100644
--- a/chrome/browser/renderer_host/offline_resource_handler.cc
+++ b/chrome/browser/renderer_host/offline_resource_handler.cc
@@ -32,8 +32,7 @@ OfflineResourceHandler::OfflineResourceHandler(
render_view_id_(route_id),
rdh_(rdh),
request_(request),
- deferred_request_id_(-1),
- offline_page_shown_(false) {
+ deferred_request_id_(-1) {
}
OfflineResourceHandler::~OfflineResourceHandler() {
@@ -71,11 +70,6 @@ void OfflineResourceHandler::OnRequestClosed() {
appcache_completion_callback_->Cancel();
appcache_completion_callback_.release();
Release(); // Balanced with OnWillStart
- } else if (offline_page_shown_) {
- offline_page_shown_ = false;
- // Interstitial page is already closed, so we need
- // |Release| to balance with OnWillStart.
- Release();
}
next_handler_->OnRequestClosed();
}
@@ -94,7 +88,6 @@ void OfflineResourceHandler::OnCanHandleOfflineComplete(int rv) {
Release(); // Balanced with OnWillStart
} else {
// Skipping AddRef/Release because they're redundant.
- offline_page_shown_ = true;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &OfflineResourceHandler::ShowOfflinePage));
@@ -150,9 +143,6 @@ void OfflineResourceHandler::OnBlockingPageComplete(bool proceed) {
NOTREACHED();
return;
}
- DCHECK(offline_page_shown_);
- offline_page_shown_ = false;
-
if (proceed) {
Resume();
} else {
diff --git a/chrome/browser/renderer_host/offline_resource_handler.h b/chrome/browser/renderer_host/offline_resource_handler.h
index 33e4549..6fa17a0 100644
--- a/chrome/browser/renderer_host/offline_resource_handler.h
+++ b/chrome/browser/renderer_host/offline_resource_handler.h
@@ -76,9 +76,6 @@ class OfflineResourceHandler : public ResourceHandler,
int deferred_request_id_;
GURL deferred_url_;
- // If the offline page has been requested to show.
- bool offline_page_shown_;
-
scoped_refptr<net::CancelableCompletionCallback<OfflineResourceHandler> >
appcache_completion_callback_;
diff --git a/chrome/browser/resources/activate_broadband_info.png b/chrome/browser/resources/activate_broadband_info.png
new file mode 100644
index 0000000..07a9f43
--- /dev/null
+++ b/chrome/browser/resources/activate_broadband_info.png
Binary files differ
diff --git a/chrome/browser/resources/offline_load.html b/chrome/browser/resources/offline_load.html
index 9a06022..0a03c45 100644
--- a/chrome/browser/resources/offline_load.html
+++ b/chrome/browser/resources/offline_load.html
@@ -8,6 +8,7 @@ html {
height: 100%;
}
body {
+ border: green 1px solid;
color: #000;
font-family: Helvetica, Arial, sans-serif;
background-image: -webkit-linear-gradient(white 50%, rgb(236, 244, 255));
@@ -15,38 +16,84 @@ body {
padding: 0;
margin: 0;
display: -webkit-box;
- -webkit-box-orient: horizontal;
+ -webkit-box-orient: vertical;
-webkit-box-pack: center;
- visibility: hidden;
+ -webkit-box-align: center;
+}
+
+.upper {
+ width: 60%;
+ height: 50%;
}
-#error {
- margin-top: 150px;
- font-size: 16px;
+.upper_main {
+ position: relative;
+ width: 100%;
+ bottom: -35%;
+}
+
+.lower {
+ height: 50%;
+ width: 100%;
display: -webkit-box;
- width : 800px;
- max-width: 80%;
+ -webkit-box-pack: center;
-webkit-box-orient: horizontal;
}
-#error img {
- vertical-align: middle;
- width: 96px;
- height: 96px;
- -webkit-margin-end: 10px;
- -webkit-box-flex: 0;
+.lower_left {
+ height: 100%;
+ width: 24%;
+ background-image: -webkit-linear-gradient(-100deg, rgb(230, 230, 230), rgb(230, 230, 230) 3px, rgb(240, 240, 240) 3px, rgba(240, 240, 240, 0) 20%);
+}
+
+.lower_right {
+ height: 100%;
+ width: 24%;
+ background-image: -webkit-linear-gradient(-80deg, rgb(230, 230, 230), rgb(230, 230, 230) 3px, rgb(240, 240, 240) 3px, rgba(240, 240, 240, 0) 20%);
+}
+
+.lower_main {
+ position: relative;
+ height: 100%;
+ width: 50%;
+ padding-top: 20px;
+ background-image: -webkit-linear-gradient(rgb(230, 230, 230), rgb(230, 230, 230) 3px, rgb(240, 240, 240) 3px, rgba(240, 240, 240, 0) 20%);
}
-#error #msg_box {
- vertical-align: middle;
- -webkit-box-flex: 1;
+.icon {
+ float: left;
+ margin: 15px;
+ overflow: visible;
+}
+
+.title {
+ float: left;
+ height: 10%;
+ width: 80%;
+ font-family: Sans-serif;
+ font-size: 120%;
+ font-weight: bold;
+ padding: 3px;
+}
+
+.message {
+ float: left;
+ margin-top: 10px;
+}
+
+.link {
+ float: left;
+ clear: both;
+ padding: 3px;
+}
+
+.activation_button {
+ float: left;
+ clear both;
}
</style>
-<script src="shared/js/local_strings.js"></script>
<script>
-var localStrings = new LocalStrings();
-
function sendCommand(cmd) {
window.domAutomationController.setAutomationId(1);
window.domAutomationController.send(cmd);
@@ -55,32 +102,42 @@ function sendCommand(cmd) {
function showPage() {
document.body.style.visibility = 'visible';
}
-document.addEventListener('DOMContentLoaded', function() {
- var timeToWait = localStrings.getString('timeToWait');
- window.setTimeout(showPage, timeToWait);
-});
+// Start the timer to show the page.
+function startTimer(time) {
+ // wait 2.5 seconds before showing 'load now', 'go back' button.
+ setTimeout('showPage()', time);
+}
</script>
-</head>
<body oncontextmenu="return false;">
-<div id="error" i18n-values=".title:url">
- <img i18n-values=".src:icon;.style.display:display_icon">
- <div id="msg_box">
- <h3 i18n-content="heading"></h3>
- <div id="msg" i18n-values=".innerHTML:msg"></div>
-
- <button id="continue_button" i18n-content="load_button"
- onclick="sendCommand('proceed')">
- </button>
- <button id="cancel_button" i18n-content="cancel_button"
- i18n-values=".style.display:display_cancel"
- onclick="sendCommand('dontproceed')">
- </button>
- <a href="chrome://settings/internet"
- onclick="sendCommand('open_network_settings')"
- i18n-content="network_settings">
- </a>
+ <div class="upper" i18n-values=".title:url">
+ <div class="upper_main">
+ <div class="icon" i18n-values=".src:icon;.style.display:display_icon"></div>
+ <div class="title" i18n-content="heading"> </div>
+ <div class="message" i18n-values=".innerHTML:msg"> </div>
+ <div class="link"><a href="chrome://settings/internet"
+ onclick="sendCommand('proceed')"
+ i18n-content="try_loading">
+ </a> </div>
+ <div class="link">
+ <a href="chrome://settings/internet"
+ onclick="sendCommand('open_network_settings')"
+ i18n-content="network_settings">
+ </a>
+ </div>
+ </div>
+ </div>
+ <div class="lower" i18n-values=".style.display:display_activation">
+ <div class="lower_left"> </div>
+ <div class="lower_main">
+ <img class="icon" src="activate_broadband_info.png"></img>
+ <div class="title" i18n-content="activation_heading"></div>
+ <div class="message" i18n-content="activation_msg"></div>
+ <button class="activation_button" i18n-content="activation_button"
+ onclick="sendCommand('open_activate_broadband')">
+ </button>
+ </div>
+ <div class="lower_right"> </div>
</div>
-</div>
</body>
</html>