help_app_launcher.h revision 201ade2fbba22bfb27ae029f4d23fca6ded109a0
1// Copyright (c) 2010 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_CHROMEOS_LOGIN_HELP_APP_LAUNCHER_H_
6#define CHROME_BROWSER_CHROMEOS_LOGIN_HELP_APP_LAUNCHER_H_
7#pragma once
8
9#include "base/scoped_ptr.h"
10#include "chrome/browser/chromeos/login/login_html_dialog.h"
11#include "gfx/native_widget_types.h"
12
13namespace chromeos {
14
15// Provides help content during OOBE / login.
16// Based on connectivity state (offline/online) shows help topic dialog
17// or launches HelpApp in BWSI mode.
18class HelpAppLauncher : public LoginHtmlDialog::Delegate {
19 public:
20  // IDs of help topics available from HelpApp.
21  enum HelpTopic {
22    // Showed on basic connectivity issues.
23    HELP_CONNECTIVITY,
24    // Showed at EULA screen as "Learn more" about stats/crash reports.
25    HELP_STATS_USAGE,
26    // Showed whenever there're troubles signing in (offline case).
27    HELP_CANT_ACCESS_ACCOUNT_OFFLINE,
28    // Showed whenever there're troubles signing in (online case).
29    HELP_CANT_ACCESS_ACCOUNT,
30    // Showed in case when account was disabled.
31    HELP_ACCOUNT_DISABLED,
32    // Showed in case when hosted account is used.
33    HELP_HOSTED_ACCOUNT,
34    HELP_TOPIC_COUNT
35  };
36
37  // Parent window is used to show dialog.
38  explicit HelpAppLauncher(gfx::NativeWindow parent_window);
39
40  // Shows specified help topic.
41  // TODO: Pass topic ID.
42  void ShowHelpTopic(HelpTopic help_topic_id);
43
44  // Returns true if the dialog is currently open.
45  bool is_open() const { return dialog_.get() && dialog_->is_open(); }
46
47 protected:
48  // LoginHtmlDialog::Delegate implementation:
49  virtual void OnDialogClosed() {}
50
51 private:
52  // Shows help topic dialog for specified GURL.
53  void ShowHelpTopicDialog(const GURL& topic_url);
54
55  // Dialog used to display help like "Can't access your account".
56  scoped_ptr<LoginHtmlDialog> dialog_;
57
58  // Parent window which is passed to help dialog.
59  gfx::NativeWindow parent_window_;
60
61  DISALLOW_COPY_AND_ASSIGN(HelpAppLauncher);
62};
63
64}  // namespace chromeos
65
66#endif  // CHROME_BROWSER_CHROMEOS_LOGIN_HELP_APP_LAUNCHER_H_
67