OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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 #ifdef CHROME_PERSONALIZATION |
| 6 |
| 7 // TODO(timsteele): Remove this file by finding proper homes for everything in |
| 8 // trunk. |
| 9 #ifndef CHROME_BROWSER_SYNC_PERSONALIZATION_H_ |
| 10 #define CHROME_BROWSER_SYNC_PERSONALIZATION_H_ |
| 11 |
| 12 #include <string> |
| 13 #include "base/basictypes.h" |
| 14 #include "chrome/browser/dom_ui/chrome_url_data_manager.h" |
| 15 |
| 16 class Browser; |
| 17 class DOMUI; |
| 18 class DOMMessageHandler; |
| 19 class Profile; |
| 20 class RenderView; |
| 21 class RenderViewHost; |
| 22 class WebFrame; |
| 23 class WebView; |
| 24 |
| 25 class ProfileSyncService; |
| 26 class ProfileSyncServiceObserver; |
| 27 |
| 28 namespace views { class View; } |
| 29 |
| 30 // TODO(ncarter): Move these switches into chrome_switches. They are here |
| 31 // now because we want to keep them secret during early development. |
| 32 namespace switches { |
| 33 extern const wchar_t kSyncServiceURL[]; |
| 34 extern const wchar_t kSyncServicePort[]; |
| 35 extern const wchar_t kSyncUserForTest[]; |
| 36 extern const wchar_t kSyncPasswordForTest[]; |
| 37 } |
| 38 |
| 39 // Names of various preferences. |
| 40 // TODO(munjal): Move these preferences to common/pref_names.h. |
| 41 namespace prefs { |
| 42 extern const wchar_t kSyncPath[]; |
| 43 extern const wchar_t kSyncLastSyncedTime[]; |
| 44 extern const wchar_t kSyncUserName[]; |
| 45 extern const wchar_t kSyncHasSetupCompleted[]; |
| 46 } |
| 47 |
| 48 // Contains a profile sync service, which is initialized at profile creation. |
| 49 // A pointer to this class is passed as a handle. |
| 50 class ProfilePersonalization { |
| 51 public: |
| 52 ProfilePersonalization() {} |
| 53 virtual ~ProfilePersonalization() {} |
| 54 |
| 55 virtual ProfileSyncService* sync_service() = 0; |
| 56 |
| 57 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(ProfilePersonalization); |
| 59 }; |
| 60 |
| 61 // Contains methods to perform Personalization-related tasks on behalf of the |
| 62 // caller. |
| 63 namespace Personalization { |
| 64 |
| 65 // Checks if P13N is globally disabled or not, and that |profile| has a valid |
| 66 // ProfilePersonalization member (it can be NULL for TestingProfiles). |
| 67 bool IsP13NDisabled(Profile* profile); |
| 68 |
| 69 // Returns whether |url| should be loaded in a DOMUI. |
| 70 bool NeedsDOMUI(const GURL& url); |
| 71 |
| 72 // Construct a new ProfilePersonalization and return it so the caller can take |
| 73 // ownership. |
| 74 ProfilePersonalization* CreateProfilePersonalization(Profile* p); |
| 75 |
| 76 // The caller of Create...() above should call this when the returned |
| 77 // ProfilePersonalization object should be deleted. |
| 78 void CleanupProfilePersonalization(ProfilePersonalization* p); |
| 79 |
| 80 // Handler for "cloudy:stats" |
| 81 std::string MakeCloudyStats(); |
| 82 |
| 83 // Construct a new DOMMessageHandler for the new tab page |dom_ui|. |
| 84 DOMMessageHandler* CreateNewTabPageHandler(DOMUI* dom_ui); |
| 85 |
| 86 // Get HTML for the Personalization iframe in the New Tab Page. |
| 87 std::string GetNewTabSource(); |
| 88 |
| 89 // Returns the text for personalization info menu item and sets its enabled |
| 90 // state. |
| 91 std::wstring GetMenuItemInfoText(Browser* browser); |
| 92 |
| 93 // Performs appropriate action when the sync menu item is clicked. |
| 94 void HandleMenuItemClick(Profile* p); |
| 95 } // namespace Personalization |
| 96 |
| 97 // The internal scheme used to retrieve HTML resources for personalization |
| 98 // related code (e.g cloudy:stats, GAIA login page). |
| 99 // We need to ensure the GAIA login HTML is loaded into an HTMLDialogContents. |
| 100 // Outside of p13n (for the time being) only "gears://" gives this (see |
| 101 // HtmlDialogContents::IsHtmlDialogUrl) for the application shortcut dialog. |
| 102 // TODO(timsteele): We should have a robust way to handle this to allow more |
| 103 // reuse of our HTML dialog code, perhaps by using a dedicated "dialog-resource" |
| 104 // scheme (chrome-resource is coupled to DOM_UI). Figure out if that is the best |
| 105 // course of action / pitch this idea to chromium-dev. |
| 106 static const char kPersonalizationScheme[] = "cloudy"; |
| 107 |
| 108 #endif // CHROME_BROWSER_SYNC_PERSONALIZATION_H_ |
| 109 #endif // CHROME_PERSONALIZATION |
OLD | NEW |