blob: 8bcd85ab71d9ab65eaddaa045db46c8660c25df0 [file] [log] [blame]
[email protected]40f047972009-11-25 03:54:401// Copyright (c) 2009 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
6#define CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
[email protected]32b76ef2010-07-26 23:08:247#pragma once
[email protected]40f047972009-11-25 03:54:408
[email protected]f1e6e0212010-10-15 20:54:249#include <string>
10
[email protected]40f047972009-11-25 03:54:4011#include "base/string16.h"
[email protected]f1e6e0212010-10-15 20:54:2412#include "base/values.h"
[email protected]40f047972009-11-25 03:54:4013#include "chrome/browser/sync/profile_sync_service.h"
14
15class Profile;
[email protected]f1e6e0212010-10-15 20:54:2416class ListValue;
17class DictionaryValue;
[email protected]40f047972009-11-25 03:54:4018
19// Utility functions to gather current sync status information from the sync
20// service and constructs messages suitable for showing in UI.
21namespace sync_ui_util {
22
23enum MessageType {
24 PRE_SYNCED, // User has not set up sync.
25 SYNCED, // We are synced and authenticated to a gmail account.
26 SYNC_ERROR, // A sync error (such as invalid credentials) has occurred.
27};
28
[email protected]06eee70c2010-01-06 22:27:3929// TODO(akalin): audit the use of ProfileSyncService* service below,
30// and use const ProfileSyncService& service where possible.
31
[email protected]40f047972009-11-25 03:54:4032// Create status and link labels for the current status labels and link text
33// by querying |service|.
34MessageType GetStatusLabels(ProfileSyncService* service,
35 string16* status_label,
36 string16* link_label);
37
[email protected]5c086d72009-12-14 20:49:0438MessageType GetStatus(ProfileSyncService* service);
39
[email protected]06eee70c2010-01-06 22:27:3940// Determines whether or not the sync error button should be visible.
41bool ShouldShowSyncErrorButton(ProfileSyncService* service);
42
43// Returns a string with the synchronization status.
44string16 GetSyncMenuLabel(ProfileSyncService* service);
45
[email protected]40f047972009-11-25 03:54:4046// Open the appropriate sync dialog for the given profile (which can be
47// incognito). |code| should be one of the START_FROM_* codes.
48void OpenSyncMyBookmarksDialog(
49 Profile* profile, ProfileSyncService::SyncEventCodes code);
[email protected]40f047972009-11-25 03:54:4050
[email protected]f1e6e0212010-10-15 20:54:2451void AddBoolSyncDetail(ListValue* details,
52 const std::string& stat_name,
53 bool stat_value);
54
55void ConstructAboutInformation(ProfileSyncService* service,
56 DictionaryValue* strings);
57
58void AddIntSyncDetail(ListValue* details,
59 const std::string& stat_name,
60 int64 stat_value);
61} // namespace sync_ui_util
[email protected]40f047972009-11-25 03:54:4062#endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
63