Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Add a flag to app_shell that allows roaming on cellular networks
Browse files Browse the repository at this point in the history
BUG=chrome-os-partner:37102
NOPRESUBMIT=true
NOTRY=true

Review URL: https://codereview.chromium.org/1085973002

Cr-Commit-Position: refs/heads/master@{#325525}
(cherry picked from commit 97ecc6e)

Review URL: https://codereview.chromium.org/1070343003

Cr-Commit-Position: refs/branch-heads/2357@{#171}
Cr-Branched-From: 59d4494-refs/heads/master@{#323860}
  • Loading branch information
jason-simmons authored and Commit bot committed Apr 20, 2015
1 parent 08d2b96 commit 655a170
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extensions/shell/browser/shell_browser_main_parts.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ void ShellBrowserMainParts::PostMainMessageLoopStart() {
network_controller_.reset(new ShellNetworkController(
base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(
switches::kAppShellPreferredNetwork)));

if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kAppShellAllowRoaming)) {
network_controller_->SetCellularAllowRoaming(true);
}

#else
// Non-Chrome OS platforms are for developer convenience, so use a test IME.
ui::InitializeInputMethodForTesting();
Expand Down
7 changes: 7 additions & 0 deletions extensions/shell/browser/shell_network_controller_chromeos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "chromeos/network/network_connection_handler.h"
#include "chromeos/network/network_device_handler.h"
#include "chromeos/network/network_handler.h"
#include "chromeos/network/network_handler_callbacks.h"
#include "chromeos/network/network_state.h"
Expand Down Expand Up @@ -102,6 +103,12 @@ void ShellNetworkController::NetworkConnectionStateChanged(
}
}

void ShellNetworkController::SetCellularAllowRoaming(bool allow_roaming) {
chromeos::NetworkDeviceHandler* device_handler =
chromeos::NetworkHandler::Get()->network_device_handler();
device_handler->SetCellularAllowRoaming(allow_roaming);
}

const chromeos::NetworkState* ShellNetworkController::GetActiveWiFiNetwork() {
chromeos::NetworkStateHandler* state_handler =
chromeos::NetworkHandler::Get()->network_state_handler();
Expand Down
3 changes: 3 additions & 0 deletions extensions/shell/browser/shell_network_controller_chromeos.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class ShellNetworkController : public chromeos::NetworkStateHandlerObserver {
void NetworkConnectionStateChanged(
const chromeos::NetworkState* state) override;

// Control whether the cellular network connection allows roaming.
void SetCellularAllowRoaming(bool allow_roaming);

private:
// State of communication with the connection manager.
enum State {
Expand Down
3 changes: 3 additions & 0 deletions extensions/shell/common/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
namespace extensions {
namespace switches {

// Allow roaming in the cellular network.
const char kAppShellAllowRoaming[] = "app-shell-allow-roaming";

// Size for the host window to create (i.e. "800x600").
const char kAppShellHostWindowSize[] = "app-shell-host-window-size";

Expand Down
1 change: 1 addition & 0 deletions extensions/shell/common/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace switches {

// All switches in alphabetical order. The switches should be documented
// alongside the definition of their values in the .cc file.
extern const char kAppShellAllowRoaming[];
extern const char kAppShellHostWindowSize[];
extern const char kAppShellInstallCrx[];
extern const char kAppShellPreferredNetwork[];
Expand Down

0 comments on commit 655a170

Please sign in to comment.