12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
5116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#ifndef UI_CHROMEOS_NETWORK_NETWORK_ICON_H_
6116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#define UI_CHROMEOS_NETWORK_NETWORK_ICON_H_
72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <string>
92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h"
11116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "ui/chromeos/ui_chromeos_export.h"
122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/gfx/image/image_skia.h"
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace chromeos {
152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class NetworkState;
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
18116680a4aac90f2aa7413d9095a592090648e557Ben Murdochnamespace ui {
192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)namespace network_icon {
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class AnimationObserver;
222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Type of icon which dictates color theme and VPN badging
242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)enum IconType {
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ICON_TYPE_TRAY,  // light icons with VPN badges
262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ICON_TYPE_DEFAULT_VIEW,  // dark icons with VPN badges
272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ICON_TYPE_LIST,  // dark icons without VPN badges
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Gets the image for the network associated with |service_path|. |network| must
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// not be NULL. |icon_type| determines the color theme and whether or not to
322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// show the VPN badge. This caches badged icons per network per |icon_type|.
33116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForNetwork(
34868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    const chromeos::NetworkState* network,
35868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    IconType icon_type);
36868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
3746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// Similar to GetImageForNetwork but returns the cached image url based on
3846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)// |scale_factor| instead.
39116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT std::string GetImageUrlForNetwork(
4046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    const chromeos::NetworkState* network,
4146d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    IconType icon_type,
4246d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)    float scale_factor);
4346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)
44868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Gets the fulls strength image for a connected network type.
45116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForConnectedNetwork(
46868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    IconType icon_type,
47868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    const std::string& network_type);
482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Gets the image for a connecting network type.
50116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForConnectingNetwork(
51868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    IconType icon_type,
52868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    const std::string& network_type);
532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Gets the image for a disconnected network type.
55116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT gfx::ImageSkia GetImageForDisconnectedNetwork(
56868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    IconType icon_type,
57868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    const std::string& network_type);
582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Returns the label for |network| based on |icon_type|. |network| can be NULL.
60116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT base::string16 GetLabelForNetwork(
61868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    const chromeos::NetworkState* network,
62868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    IconType icon_type);
632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Updates and returns the appropriate message id if the cellular network
652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// is uninitialized.
66116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT int GetCellularUninitializedMsg();
67868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
68868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Gets the correct icon and label for |icon_type|. Also sets |animating|
69868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// based on whether or not the icon is animating (i.e. connecting).
70116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT void GetDefaultNetworkImageAndLabel(IconType icon_type,
71116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                                                       gfx::ImageSkia* image,
72116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                                                       base::string16* label,
73116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                                                       bool* animating);
742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
757d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// Called when the list of networks changes. Retreives the list of networks
767d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// from the global NetworkStateHandler instance and removes cached entries
777d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)// that are no longer in the list.
78116680a4aac90f2aa7413d9095a592090648e557Ben MurdochUI_CHROMEOS_EXPORT void PurgeNetworkIconCache();
797d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)
802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}  // namespace network_icon
81116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch}  // namespace ui
822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
83116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#endif  // UI_CHROMEOS_NETWORK_NETWORK_ICON_H_
84