1 // Copyright (c) 2011 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/memory/ref_counted.h" 10 #include "base/memory/scoped_ptr.h" 11 #include "chrome/browser/chromeos/login/login_html_dialog.h" 12 #include "ui/gfx/native_widget_types.h" 13 14 namespace chromeos { 15 16 // Provides help content during OOBE / login. 17 // Based on connectivity state (offline/online) shows help topic dialog 18 // or launches HelpApp in BWSI mode. 19 class HelpAppLauncher : public LoginHtmlDialog::Delegate, 20 public base::RefCountedThreadSafe<HelpAppLauncher> { 21 public: 22 // IDs of help topics available from HelpApp. 23 enum HelpTopic { 24 // Showed on basic connectivity issues. 25 HELP_CONNECTIVITY = 188752, 26 // Showed at EULA screen as "Learn more" about stats/crash reports. 27 HELP_STATS_USAGE = 183078, 28 // Showed whenever there're troubles signing in (offline case). 29 HELP_CANT_ACCESS_ACCOUNT_OFFLINE = 188755, 30 // Showed whenever there're troubles signing in (online case). 31 HELP_CANT_ACCESS_ACCOUNT = 188036, 32 // Showed in case when account was disabled. 33 HELP_ACCOUNT_DISABLED = 188756, 34 // Showed in case when hosted account is used. 35 HELP_HOSTED_ACCOUNT = 1054228, 36 }; 37 38 // Parent window is used to show dialog. 39 explicit HelpAppLauncher(gfx::NativeWindow parent_window); 40 41 // Shows specified help topic. 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