OLD | NEW |
---|---|
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/chromeos/offline/offline_load_page.h" | 5 #include "chrome/browser/chromeos/offline/offline_load_page.h" |
6 | 6 |
7 #include "apps/launcher.h" | |
7 #include "ash/shell.h" | 8 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "base/i18n/rtl.h" | 11 #include "base/i18n/rtl.h" |
11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
12 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
13 #include "base/strings/string_piece.h" | 14 #include "base/strings/string_piece.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 17 #include "base/values.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 | 131 |
131 void OfflineLoadPage::CommandReceived(const std::string& cmd) { | 132 void OfflineLoadPage::CommandReceived(const std::string& cmd) { |
132 std::string command(cmd); | 133 std::string command(cmd); |
133 // The Jasonified response has quotes, remove them. | 134 // The Jasonified response has quotes, remove them. |
134 if (command.length() > 1 && command[0] == '"') { | 135 if (command.length() > 1 && command[0] == '"') { |
135 command = command.substr(1, command.length() - 2); | 136 command = command.substr(1, command.length() - 2); |
136 } | 137 } |
137 // TODO(oshima): record action for metrics. | 138 // TODO(oshima): record action for metrics. |
138 if (command == "open_network_settings") { | 139 if (command == "open_network_settings") { |
139 ash::Shell::GetInstance()->system_tray_delegate()->ShowNetworkSettings(""); | 140 ash::Shell::GetInstance()->system_tray_delegate()->ShowNetworkSettings(""); |
141 } else if (command == "open_connectivity_diagnostics") { | |
142 Profile* profile = Profile::FromBrowserContext( | |
143 web_contents_->GetBrowserContext()); | |
144 const extensions::Extension* extension = profile->GetExtensionService()-> | |
145 GetInstalledExtension("kodldpbjkkmmnilagfdheibampofhaom"); | |
xiyuan
2014/01/08 23:17:40
nit: add the app id to extension_constants.h|cc.
Zachary Kuznia
2014/01/08 23:23:51
Doing so in a follow up CL, as discussed.
| |
146 apps::LaunchPlatformAppWithUrl(profile, extension, "", | |
147 GURL::EmptyGURL(), GURL::EmptyGURL()); | |
148 | |
140 } else { | 149 } else { |
141 LOG(WARNING) << "Unknown command:" << cmd; | 150 LOG(WARNING) << "Unknown command:" << cmd; |
142 } | 151 } |
143 } | 152 } |
144 | 153 |
145 void OfflineLoadPage::NotifyBlockingPageComplete(bool proceed) { | 154 void OfflineLoadPage::NotifyBlockingPageComplete(bool proceed) { |
146 BrowserThread::PostTask( | 155 BrowserThread::PostTask( |
147 BrowserThread::IO, FROM_HERE, base::Bind(callback_, proceed)); | 156 BrowserThread::IO, FROM_HERE, base::Bind(callback_, proceed)); |
148 } | 157 } |
149 | 158 |
150 void OfflineLoadPage::OnConnectionTypeChanged( | 159 void OfflineLoadPage::OnConnectionTypeChanged( |
151 net::NetworkChangeNotifier::ConnectionType type) { | 160 net::NetworkChangeNotifier::ConnectionType type) { |
152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
153 const bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; | 162 const bool online = type != net::NetworkChangeNotifier::CONNECTION_NONE; |
154 DVLOG(1) << "ConnectionTypeObserver notification received: state=" | 163 DVLOG(1) << "ConnectionTypeObserver notification received: state=" |
155 << (online ? "online" : "offline"); | 164 << (online ? "online" : "offline"); |
156 if (online) { | 165 if (online) { |
157 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); | 166 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
158 interstitial_page_->Proceed(); | 167 interstitial_page_->Proceed(); |
159 } | 168 } |
160 } | 169 } |
161 | 170 |
162 } // namespace chromeos | 171 } // namespace chromeos |
OLD | NEW |