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