1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#ifndef ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_CONNECT_H
6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_CONNECT_H
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include <string>
9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "ash/ash_export.h"
117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "base/strings/string16.h"
12ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
13ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdochnamespace base {
14ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdochclass DictionaryValue;
15ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch}
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
1758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)namespace chromeos {
1858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)class NetworkTypePattern;
1958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)}
2058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace ash {
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace network_connect {
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
243551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)ASH_EXPORT extern const char kNetworkConnectNotificationId[];
253551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)ASH_EXPORT extern const char kNetworkActivateNotificationId[];
263551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
2758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)ASH_EXPORT extern const char kErrorActivateFailed[];
2858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
29ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// Requests a network connection and handles any errors and notifications.
301320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciASH_EXPORT void ConnectToNetwork(const std::string& service_path);
31ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
323551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Enables or disables a network technology. If |technology| refers to cellular
333551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// and the device cannot be enabled due to a SIM lock, this function will
343551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// launch the SIM unlock dialog.
3558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)ASH_EXPORT void SetTechnologyEnabled(
3658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)    const chromeos::NetworkTypePattern& technology,
3758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)    bool enabled_state);
383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
39ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// Requests network activation and handles any errors and notifications.
40ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben MurdochASH_EXPORT void ActivateCellular(const std::string& service_path);
41ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
423551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Determines whether or not a network requires a connection to activate or
433551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// setup and either shows a notification or opens the mobile setup dialog.
443551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)ASH_EXPORT void ShowMobileSetup(const std::string& service_path);
453551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
46ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// Configures a network with a dictionary of Shill properties, then sends a
47ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// connect request. The profile is set according to 'shared' if allowed.
48ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben MurdochASH_EXPORT void ConfigureNetworkAndConnect(
49ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch    const std::string& service_path,
50ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch    const base::DictionaryValue& properties,
51ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch    bool shared);
52ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch
53ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch// Requests a new network configuration to be created from a dictionary of
54effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// Shill properties and sends a connect request if the configuration succeeds.
55effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// The profile used is determined by |shared|.
56ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben MurdochASH_EXPORT void CreateConfigurationAndConnect(base::DictionaryValue* properties,
57ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch                                              bool shared);
58868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
59effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// Requests a new network configuration to be created from a dictionary of
60effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch// Shill properties. The profile used is determined by |shared|.
61effb81e5f8246d0db0270817048dc992db66e9fbBen MurdochASH_EXPORT void CreateConfiguration(base::DictionaryValue* properties,
62effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                                    bool shared);
63effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
647dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Returns the localized string for shill error string |error|.
654e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)ASH_EXPORT base::string16 ErrorString(const std::string& error,
664e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                                      const std::string& service_path);
677dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
683551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// Shows the settings for the network specified by |service_path|. If empty,
693551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)// or no matching network exists, shows the general internet settings page.
703551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)ASH_EXPORT void ShowNetworkSettings(const std::string& service_path);
713551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)
72868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // network_connect
73868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // ash
74868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
75868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#endif  // ASH_SYSTEM_CHROMEOS_NETWORK_NETWORK_CONNECT_H
76