diff options
author | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-26 14:01:46 +0000 |
---|---|---|
committer | mnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-26 14:01:46 +0000 |
commit | b0c78f6652344e141ff2b7da804ed84351a2ae8a (patch) | |
tree | dc610d78a7350efa0029116d2c5be0e901ee7a15 | |
parent | f946edc1d03dda4c4fed3ff05b8c317f1b18fa7a (diff) | |
download | chromium_src-b0c78f6652344e141ff2b7da804ed84351a2ae8a.zip chromium_src-b0c78f6652344e141ff2b7da804ed84351a2ae8a.tar.gz chromium_src-b0c78f6652344e141ff2b7da804ed84351a2ae8a.tar.bz2 |
Implement a policy to specify which pages to restore at startup. The admin can choose no restore, last opened windows, or specific pages to be opened.
xib changes: Added an enabled binding to the policy-controlled "Restore on Startup" radiobox group in the "Basic" preference pane. They can be disabled when their value is overridden by policy. The methods for the bindings are in the preference window controller.
BUG=49297
TEST=ConfigurationPolicyPrefStoreTest.* and ConfigurationPolicyProviderWinTest.* Manual tests: Set the policies externally. Check that appropriate restore action is done at startup. Check that the Restore on Startup buttons are disabled.
Review URL: http://codereview.chromium.org/3115021
Patch from Jean-Luc Brouillet <jeanluc@google.com>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57513 0039d316-1c4b-4281-b951-d872f2087c98
21 files changed, 417 insertions, 152 deletions
diff --git a/chrome/app/nibs/Preferences.xib b/chrome/app/nibs/Preferences.xib index da66a74..9cfcdf5 100644 --- a/chrome/app/nibs/Preferences.xib +++ b/chrome/app/nibs/Preferences.xib @@ -13,6 +13,7 @@ <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> <integer value="482"/> + <integer value="79"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -754,7 +755,7 @@ <bool key="NSSharedInstance">YES</bool> </object> <object class="NSCustomView" id="930668015"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">268</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -1716,6 +1717,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> </object> <string key="NSFrameSize">{540, 445}</string> + <reference key="NSSuperview"/> <string key="NSClassName">NSView</string> </object> <object class="NSCustomView" id="393583039"> @@ -2464,54 +2466,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> <object class="IBConnectionRecord"> <object class="IBBindingConnection" key="connection"> - <string key="label">enabled: enableRestoreButtons</string> - <reference key="source" ref="909713979"/> - <reference key="destination" ref="1001"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="909713979"/> - <reference key="NSDestination" ref="1001"/> - <string key="NSLabel">enabled: enableRestoreButtons</string> - <string key="NSBinding">enabled</string> - <string key="NSKeyPath">enableRestoreButtons</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">290</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">enabled: enableRestoreButtons</string> - <reference key="source" ref="810089388"/> - <reference key="destination" ref="1001"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="810089388"/> - <reference key="NSDestination" ref="1001"/> - <string key="NSLabel">enabled: enableRestoreButtons</string> - <string key="NSBinding">enabled</string> - <string key="NSKeyPath">enableRestoreButtons</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">294</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">enabled: enableRestoreButtons</string> - <reference key="source" ref="940065158"/> - <reference key="destination" ref="1001"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="940065158"/> - <reference key="NSDestination" ref="1001"/> - <string key="NSLabel">enabled: enableRestoreButtons</string> - <string key="NSBinding">enabled</string> - <string key="NSKeyPath">enableRestoreButtons</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">295</int> - </object> - <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> <string key="label">selectedIndex: newTabPageIsHomePageIndex</string> <reference key="source" ref="743261621"/> <reference key="destination" ref="1001"/> @@ -2675,22 +2629,6 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> <int key="connectionID">395</int> </object> <object class="IBConnectionRecord"> - <object class="IBBindingConnection" key="connection"> - <string key="label">enabled: enableRestoreButtons</string> - <reference key="source" ref="165250101"/> - <reference key="destination" ref="1001"/> - <object class="NSNibBindingConnector" key="connector"> - <reference key="NSSource" ref="165250101"/> - <reference key="NSDestination" ref="1001"/> - <string key="NSLabel">enabled: enableRestoreButtons</string> - <string key="NSBinding">enabled</string> - <string key="NSKeyPath">enableRestoreButtons</string> - <int key="NSNibBindingConnectorVersion">2</int> - </object> - </object> - <int key="connectionID">397</int> - </object> - <object class="IBConnectionRecord"> <object class="IBOutletConnection" key="connection"> <string key="label">customPagesArrayController_</string> <reference key="source" ref="1001"/> @@ -3879,6 +3817,86 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> <int key="connectionID">718</int> </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">enabled: restoreURLsEnabled</string> + <reference key="source" ref="909713979"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="909713979"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">enabled: restoreURLsEnabled</string> + <string key="NSBinding">enabled</string> + <string key="NSKeyPath">restoreURLsEnabled</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">720</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">enabled: restoreURLsEnabled</string> + <reference key="source" ref="940065158"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="940065158"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">enabled: restoreURLsEnabled</string> + <string key="NSBinding">enabled</string> + <string key="NSKeyPath">restoreURLsEnabled</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">721</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">enabled: restoreURLsEnabled</string> + <reference key="source" ref="810089388"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="810089388"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">enabled: restoreURLsEnabled</string> + <string key="NSBinding">enabled</string> + <string key="NSKeyPath">restoreURLsEnabled</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">722</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">enabled: restoreButtonsEnabled</string> + <reference key="source" ref="1016627403"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="1016627403"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">enabled: restoreButtonsEnabled</string> + <string key="NSBinding">enabled</string> + <string key="NSKeyPath">restoreButtonsEnabled</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">723</int> + </object> + <object class="IBConnectionRecord"> + <object class="IBBindingConnection" key="connection"> + <string key="label">enabled: restoreButtonsEnabled</string> + <reference key="source" ref="165250101"/> + <reference key="destination" ref="1001"/> + <object class="NSNibBindingConnector" key="connector"> + <reference key="NSSource" ref="165250101"/> + <reference key="NSDestination" ref="1001"/> + <string key="NSLabel">enabled: restoreButtonsEnabled</string> + <string key="NSBinding">enabled</string> + <string key="NSKeyPath">restoreButtonsEnabled</string> + <int key="NSNibBindingConnectorVersion">2</int> + </object> + </object> + <int key="connectionID">724</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -5597,7 +5615,7 @@ AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA</bytes> </object> </object> <nil key="sourceID"/> - <int key="maxID">719</int> + <int key="maxID">724</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> diff --git a/chrome/app/policy/mac/app-Manifest.plist b/chrome/app/policy/mac/app-Manifest.plist index 4fb2e68..fec3043 100644 --- a/chrome/app/policy/mac/app-Manifest.plist +++ b/chrome/app/policy/mac/app-Manifest.plist @@ -44,6 +44,53 @@ </dict> <dict> <key>pfm_name</key> + <string>RestoreOnStartup</string> + <key>pfm_description</key> + <string>This policy allows you to configure the pages that will be automatically opened when Chrome starts. RestoreOnStartup can be set to None, Last Session, or a list of URLs you specify. If you specify the None or Last Session as the RestoreOnStartup, the list of URLs is ignored. 0 = None, 1 = Last Opened, 4 = Specific URLs</string> + <key>pfm_title</key> + <string>Configure the pages to be restored on startup</string> + <key>pfm_targets</key> + <array> + <string>user-managed</string> + </array> + <key>pfm_type</key> + <string>integer</string> + <key>pfm_range_list</key> + <array> + <integer>0</integer> + <integer>1</integer> + <integer>4</integer> + </array> + </dict> + <dict> + <key>pfm_name</key> + <string>RestoreOnStartupURLs</string> + <key>pfm_description</key> + <string>This policy allows you to specify which URLs to open when Chrome starts. This policy only takes effect if the key "Configure the pages to be restored..." is set to 4.</string> + <key>pfm_title</key> + <string>List of URLs to be restored on startup</string> + <key>pfm_targets</key> + <array> + <string>user-managed</string> + </array> + <key>pfm_type</key> + <string>array</string> + <key>pfm_subkeys</key> + <array> + <dict> + <key>pfm_name</key> + <string>restoreURL</string> + <key>pfm_title</key> + <string>URL to restore</string> + <key>pfm_description</key> + <string>URL to restore at startup. This takes effect only if the key "Configure the pages to be restored..." is set to 4.</string> + <key>pfm_type</key> + <string>string</string> + </dict> + </array> + </dict> + <dict> + <key>pfm_name</key> <string>ProxyServerMode</string> <key>pfm_description</key> <string>This policy allows you to specify the proxy server used by Google Chrome. If you choose to disable the proxy server settings by choosing always to use a direct connection, all other options will be ignored. If you specify a proxy server, the autodetect option will be ignored. For detailed examples, visit: http://www.chromium.org/developers/design-documents/network-settings#TOC-Command-line-options-for-proxy-sett 0 = Disabled, 1 = Autodetect, 2 = Manual, 3 = Use System Proxy</string> diff --git a/chrome/app/policy/windows/adm/en-US/chrome.adm b/chrome/app/policy/windows/adm/en-US/chrome.adm index 357552b..031b3c9 100644 --- a/chrome/app/policy/windows/adm/en-US/chrome.adm +++ b/chrome/app/policy/windows/adm/en-US/chrome.adm @@ -33,6 +33,27 @@ CLASS MACHINE END PART
END POLICY
+ POLICY !!RestoreOnStartup
+ #if version >= 4
+ SUPPORTED !!SUPPORTED_WINXPSP2
+ #endif
+ EXPLAIN !!RestoreOnStartup_Explain
+
+ PART !!RestoreOnStartupMode DROPDOWNLIST
+ VALUENAME "RestoreOnStartup"
+ ITEMLIST
+ NAME !!RestoreOnStartupIsNone VALUE NUMERIC 0
+ NAME !!RestoreOnStartupIsLastSession VALUE NUMERIC 1
+ NAME !!RestoreOnStartupIsURLs VALUE NUMERIC 4
+ END ITEMLIST
+ END PART
+
+ KEYNAME "Software\Policies\Google\Chrome\RestoreOnStartupURLs"
+ PART !!RestoreOnStartupURLs LISTBOX
+ VALUEPREFIX ""
+ END PART
+ END POLICY
+
POLICY !!ApplicationLocale
#if version >= 4
SUPPORTED !!SUPPORTED_WINXPSP2
@@ -211,7 +232,7 @@ CLASS MACHINE SUPPORTED_WINXPSP2="At least Microsoft Windows XP SP2"
google="Google"
googlechrome="Google Chrome"
-ApplicationLocale="Configures the application locale"
+ApplicationLocale="Configure the application locale"
ApplicationLocale_Explain="Configures the application locale in Google Chrome and prevents users from changing the locale.\n\n\
If you enable this setting, Google Chrome uses the specified locale. If the configured locale is not supported, 'en-US' is used instead.\n\n\
If this setting is disabled or not configured, Google Chrome uses either the user-specified preferred locale (if configured), the system locale or the fallback locale 'en-US'."
@@ -225,6 +246,16 @@ HomepageMode="Homepage type:" HomepageIsLocationURL="Always use homepage URL as homepage"
HomepageIsNewTabPage="Always use New Tab Page as homepage"
HomepageLocation="Homepage URL:"
+RestoreOnStartup="Configure the pages to be restored on startup"
+RestoreOnStartup_Explain="Configures the pages that will be automatically opened when Chrome starts.\n\n\
+RestoreOnStartup can be set to None, Last Session, or a list of URLs you specify.\n\n\
+If you specify the None or Last Session as the RestoreOnStartup, the list of URLs is ignored.\n\n\
+If you enable this setting, users cannot change their RestoreOnStartup settings in Google Chrome."
+RestoreOnStartupMode="At startup,"
+RestoreOnStartupIsNone="open the home page"
+RestoreOnStartupIsLastSession="restore the last opened pages"
+RestoreOnStartupIsURLs="open specific URLs"
+RestoreOnStartupURLs="URLs to be opened:"
Proxy="Configure proxy server"
Proxy_Explain="Allows you to specify the proxy server used by Google Chrome and prevents users from changing proxy settings.\n\n\
If you choose to never use a proxy server and always connect directly, \
diff --git a/chrome/app/policy/windows/admx/chrome.admx b/chrome/app/policy/windows/admx/chrome.admx index 4e8b825..16ce4e8 100644 --- a/chrome/app/policy/windows/admx/chrome.admx +++ b/chrome/app/policy/windows/admx/chrome.admx @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8"?>
<policyDefinitions revision="1.0" schemaVersion="1.0">
<policyNamespaces>
- <target prefix="fullarmor" namespace="FullArmor.9a299da5-c137-4961-be67-d0354b8b3037" />
+ <target prefix="fullarmor" namespace="FullArmor.8081fe0d-e6b1-4b41-a574-7f4b644f3c33" />
<using prefix="windows" namespace="Microsoft.Policies.Windows" />
</policyNamespaces>
- <supersededAdm fileName="D:\src\chromium\src\chrome\app\policy\windows\adm\en-US\chrome.adm" />
+ <supersededAdm fileName="chrome.adm" />
<resources minRequiredRevision="1.0" />
<supportedOn>
<definitions>
@@ -38,6 +38,30 @@ <text id="HomepageLocation" valueName="HomepageLocation" />
</elements>
</policy>
+ <policy name="RestoreOnStartup" class="Machine" displayName="$(string.RestoreOnStartup)" explainText="$(string.RestoreOnStartup_Explain)" presentation="$(presentation.RestoreOnStartup)" key="Software\Policies\Google\Chrome\RestoreOnStartupURLs">
+ <parentCategory ref="googlechrome" />
+ <supportedOn ref="SUPPORTED_WINXPSP2" />
+ <elements>
+ <enum id="RestoreOnStartupMode" valueName="RestoreOnStartup">
+ <item displayName="$(string.RestoreOnStartupIsNone)">
+ <value>
+ <decimal value="0" />
+ </value>
+ </item>
+ <item displayName="$(string.RestoreOnStartupIsLastSession)">
+ <value>
+ <decimal value="1" />
+ </value>
+ </item>
+ <item displayName="$(string.RestoreOnStartupIsURLs)">
+ <value>
+ <decimal value="4" />
+ </value>
+ </item>
+ </enum>
+ <list id="RestoreOnStartupURLs" valuePrefix="" />
+ </elements>
+ </policy>
<policy name="ApplicationLocale" class="Machine" displayName="$(string.ApplicationLocale)" explainText="$(string.ApplicationLocale_Explain)" presentation="$(presentation.ApplicationLocale)" key="Software\Policies\Google\Chrome" valueName="ApplicationLocale">
<parentCategory ref="googlechrome" />
<supportedOn ref="SUPPORTED_WINXPSP2" />
@@ -188,4 +212,4 @@ </disabledValue>
</policy>
</policies>
-</policyDefinitions>
\ No newline at end of file +</policyDefinitions>
diff --git a/chrome/app/policy/windows/admx/en-US/chrome.adml b/chrome/app/policy/windows/admx/en-US/chrome.adml index 0986ba0..8392f3a 100644 --- a/chrome/app/policy/windows/admx/en-US/chrome.adml +++ b/chrome/app/policy/windows/admx/en-US/chrome.adml @@ -7,7 +7,7 @@ <string id="SUPPORTED_WINXPSP2">At least Microsoft Windows XP SP2</string>
<string id="google">Google</string>
<string id="googlechrome">Google Chrome</string>
- <string id="ApplicationLocale">Configures the application locale</string>
+ <string id="ApplicationLocale">Configure the application locale</string>
<string id="ApplicationLocale_Explain">Configures the application locale in Google Chrome and prevents users from changing the locale.
If you enable this setting, Google Chrome uses the specified locale. If the configured locale is not supported, 'en-US' is used instead.
@@ -26,6 +26,19 @@ If you enable this setting, users cannot change their homepage settings in Googl <string id="HomepageIsLocationURL">Always use homepage URL as homepage</string>
<string id="HomepageIsNewTabPage">Always use New Tab Page as homepage</string>
<string id="HomepageLocation">Homepage URL:</string>
+ <string id="RestoreOnStartup">Configure the pages to be restored on startup</string>
+ <string id="RestoreOnStartup_Explain">Configures the pages that will be automatically opened when Chrome starts.
+
+RestoreOnStartup can be set to None, Last Session, or a list of URLs you specify.
+
+If you specify the None or Last Session as the RestoreOnStartup, the list of URLs is ignored.
+
+If you enable this setting, users cannot change their RestoreOnStartup settings in Google Chrome.</string>
+ <string id="RestoreOnStartupMode">At startup,</string>
+ <string id="RestoreOnStartupIsNone">open the home page</string>
+ <string id="RestoreOnStartupIsLastSession">restore the last opened pages</string>
+ <string id="RestoreOnStartupIsURLs">open specific URLs</string>
+ <string id="RestoreOnStartupURLs">URLs to be opened:</string>
<string id="Proxy">Configure proxy server</string>
<string id="Proxy_Explain">Allows you to specify the proxy server used by Google Chrome and prevents users from changing proxy settings.
@@ -131,6 +144,10 @@ If you disable this setting, the button will be hidden.</string> <label>Homepage URL:</label>
</textBox>
</presentation>
+ <presentation id="RestoreOnStartup">
+ <dropdownList refId="RestoreOnStartupMode">At startup,</dropdownList>
+ <listBox refId="RestoreOnStartupURLs">URLs to be opened:</listBox>
+ </presentation>
<presentation id="ApplicationLocale">
<textBox refId="ApplicationLocaleValue">
<label>Application locale:</label>
@@ -170,4 +187,4 @@ If you disable this setting, the button will be hidden.</string> <presentation id="ShowHomeButton" />
</presentationTable>
</resources>
-</policyDefinitionResources>
\ No newline at end of file +</policyDefinitionResources>
diff --git a/chrome/browser/cocoa/preferences_window_controller.h b/chrome/browser/cocoa/preferences_window_controller.h index 8cfd9e8..5d2f6f8 100644 --- a/chrome/browser/cocoa/preferences_window_controller.h +++ b/chrome/browser/cocoa/preferences_window_controller.h @@ -129,6 +129,8 @@ class ProfileSyncService; IBOutlet NSButton* enableLoggingCheckbox_; scoped_ptr<PrefSetObserver> proxyPrefs_; BOOL proxiesConfigureButtonEnabled_; + BOOL restoreButtonsEnabled_; + BOOL restoreURLsEnabled_; } // Designated initializer. |profile| should not be NULL. @@ -140,6 +142,9 @@ class ProfileSyncService; // Switch to the given preference page. - (void)switchToPage:(OptionsPage)page animate:(BOOL)animate; +// Enables or disables the restoreOnStartup elements +- (void) setEnabledStateOfRestoreOnStartup; + // IBAction methods for responding to user actions. // Basics panel @@ -179,7 +184,8 @@ class ProfileSyncService; @property (assign, nonatomic) BOOL showHomeButtonEnabled; @property (assign, nonatomic) BOOL autoFillSettingsButtonEnabled; @property (assign, nonatomic) BOOL proxiesConfigureButtonEnabled; - +@property (assign, nonatomic) BOOL restoreButtonsEnabled; +@property (assign, nonatomic) BOOL restoreURLsEnabled; @end @interface PreferencesWindowController(Testing) diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index 272a3b2..ffd6c2c 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -421,6 +421,8 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase { @synthesize showHomeButtonEnabled = showHomeButtonEnabled_; @synthesize autoFillSettingsButtonEnabled = autoFillSettingsButtonEnabled_; @synthesize proxiesConfigureButtonEnabled = proxiesConfigureButtonEnabled_; +@synthesize restoreButtonsEnabled = restoreButtonsEnabled_; +@synthesize restoreURLsEnabled = restoreURLsEnabled_; - (id)initWithProfile:(Profile*)profile initialPage:(OptionsPage)initialPage { DCHECK(profile); @@ -498,8 +500,10 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase { PrefSetObserver::CreateProxyPrefSetObserver(prefs_, observer_.get())); [self setProxiesConfigureButtonEnabled:!proxyPrefs_->IsManaged()]; - // Initialize show home button checkbox enabled state. + // Initialize the enabled state of the show home button and + // restore on startup elements. [self setShowHomeButtonEnabled:!showHomeButton_.IsManaged()]; + [self setEnabledStateOfRestoreOnStartup]; } return self; } @@ -830,7 +834,7 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase { if ([key isEqualToString:@"isHomepageURLEnabled"]) { paths = [paths setByAddingObject:@"newTabPageIsHomePageIndex"]; paths = [paths setByAddingObject:@"homepageURL"]; - } else if ([key isEqualToString:@"enableRestoreButtons"]) { + } else if ([key isEqualToString:@"restoreURLsEnabled"]) { paths = [paths setByAddingObject:@"restoreOnStartupIndex"]; } else if ([key isEqualToString:@"isHomepageChoiceEnabled"]) { paths = [paths setByAddingObject:@"newTabPageIsHomePageIndex"]; @@ -891,10 +895,12 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase { const SessionStartupPref startupPref = SessionStartupPref::GetStartupPref(prefs_); [self setRestoreOnStartupIndex:startupPref.type]; + [self setEnabledStateOfRestoreOnStartup]; } if (*prefName == prefs::kURLsToRestoreOnStartup) { [customPagesSource_ reloadURLs]; + [self setEnabledStateOfRestoreOnStartup]; } if (*prefName == prefs::kHomePageIsNewTabPage) { @@ -950,10 +956,13 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase { [self saveSessionStartupWithType:startupType]; } -// Returns whether or not the +/-/Current buttons should be enabled, based on -// the current pref value for the startup urls. -- (BOOL)enableRestoreButtons { - return [self restoreOnStartupIndex] == SessionStartupPref::URLS; +// Enables or disables the restoreOnStartup elements +- (void) setEnabledStateOfRestoreOnStartup { + const SessionStartupPref startupPref = + SessionStartupPref::GetStartupPref(prefs_); + [self setRestoreButtonsEnabled:!SessionStartupPref::TypeIsManaged(prefs_)]; + [self setRestoreURLsEnabled:!SessionStartupPref::URLsAreManaged(prefs_) && + [self restoreOnStartupIndex] == SessionStartupPref::URLS]; } // Getter for the |customPagesSource| property for bindings. diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc index 585b41d0..a3c58bb 100644 --- a/chrome/browser/custom_home_pages_table_model.cc +++ b/chrome/browser/custom_home_pages_table_model.cc @@ -57,6 +57,8 @@ void CustomHomePagesTableModel::SetURLs(const std::vector<GURL>& urls) { entries_.resize(urls.size()); for (size_t i = 0; i < urls.size(); ++i) { entries_[i].url = urls[i]; + entries_[i].title.erase(); + entries_[i].icon.reset(); LoadTitleAndFavIcon(&(entries_[i])); } // Complete change, so tell the view to just rebuild itself. diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc index 18f5604..2636398 100644 --- a/chrome/browser/gtk/options/general_page_gtk.cc +++ b/chrome/browser/gtk/options/general_page_gtk.cc @@ -122,35 +122,37 @@ GeneralPageGtk::~GeneralPageGtk() { void GeneralPageGtk::NotifyPrefChanged(const std::string* pref_name) { initializing_ = true; - if (!pref_name || *pref_name == prefs::kRestoreOnStartup) { + if (!pref_name || + *pref_name == prefs::kRestoreOnStartup || + *pref_name == prefs::kURLsToRestoreOnStartup) { PrefService* prefs = profile()->GetPrefs(); const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref(prefs); + bool radio_buttons_enabled = !SessionStartupPref::TypeIsManaged(prefs); + bool restore_urls_enabled = !SessionStartupPref::URLsAreManaged(prefs); switch (startup_pref.type) { case SessionStartupPref::DEFAULT: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(startup_homepage_radio_), TRUE); - EnableCustomHomepagesControls(false); + restore_urls_enabled = false; break; case SessionStartupPref::LAST: gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(startup_last_session_radio_), TRUE); - EnableCustomHomepagesControls(false); + restore_urls_enabled = false; break; case SessionStartupPref::URLS: gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(startup_custom_radio_), TRUE); - EnableCustomHomepagesControls(true); break; } - } - - if (!pref_name || *pref_name == prefs::kURLsToRestoreOnStartup) { - PrefService* prefs = profile()->GetPrefs(); - const SessionStartupPref startup_pref = - SessionStartupPref::GetStartupPref(prefs); + gtk_widget_set_sensitive(startup_homepage_radio_, radio_buttons_enabled); + gtk_widget_set_sensitive(startup_last_session_radio_, + radio_buttons_enabled); + gtk_widget_set_sensitive(startup_custom_radio_, radio_buttons_enabled); + EnableCustomHomepagesControls(restore_urls_enabled); startup_custom_pages_table_model_->SetURLs(startup_pref.urls); } @@ -547,6 +549,12 @@ void GeneralPageGtk::SetCustomUrlListFromCurrentPages() { } void GeneralPageGtk::OnAddCustomUrl(const GURL& url) { + // The restore URLs policy might have become managed while the dialog is + // displayed. While the model makes sure that no changes are made in this + // condition, we should still avoid the rest of the method otherwise + // graphic elements will become enabled. + if (SessionStartupPref::URLsAreManaged(profile()->GetPrefs())) + return; std::set<int> indices; gtk_tree::GetSelectedIndices(startup_custom_pages_selection_, &indices); int index; diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index b702ca8..b78a56b 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -91,6 +91,10 @@ const ConfigurationPolicyPrefStore::PolicyToPreferenceMapEntry { Value::TYPE_STRING, kPolicyHomePage, prefs::kHomePage }, { Value::TYPE_BOOLEAN, kPolicyHomepageIsNewTabPage, prefs::kHomePageIsNewTabPage }, + { Value::TYPE_INTEGER, kPolicyRestoreOnStartup, + prefs::kRestoreOnStartup}, + { Value::TYPE_LIST, kPolicyURLsToRestoreOnStartup, + prefs::kURLsToRestoreOnStartup }, { Value::TYPE_BOOLEAN, kPolicyAlternateErrorPagesEnabled, prefs::kAlternateErrorPagesEnabled }, { Value::TYPE_BOOLEAN, kPolicySearchSuggestEnabled, diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc index 3f74266..986cf4d 100644 --- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc +++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc @@ -19,6 +19,17 @@ class ConfigurationPolicyPrefStoreTest : public testing::Test { ConfigurationPolicyStore::PolicyType type, const char* policy_value); + // The following three methods test a policy which controls a preference + // that is a list of strings. + // Checks that by default, it's an empty list. + void TestListPolicyGetDefault(const char* pref_name); + // Checks that values can be set. + void TestListPolicySetValue(const char* pref_name, + ConfigurationPolicyStore::PolicyType type); + // A wrapper that calls the above two methods. + void TestListPolicy(const char* pref_name, + ConfigurationPolicyStore::PolicyType type); + // The following three methods test a policy which controls a string // preference. // Checks that by default, it's an empty string. @@ -60,6 +71,42 @@ void ConfigurationPolicyPrefStoreTest::ApplyStringPolicyValue( store->Apply(type, Value::CreateStringValue(policy_value)); } +void ConfigurationPolicyPrefStoreTest::TestListPolicyGetDefault( + const char* pref_name) { + ConfigurationPolicyPrefStore store(NULL, NULL); + ListValue* list = NULL; + EXPECT_FALSE(store.prefs()->GetList(pref_name, &list)); +} + +void ConfigurationPolicyPrefStoreTest::TestListPolicySetValue( + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { + ConfigurationPolicyPrefStore store(NULL, NULL); + ListValue* in_value = new ListValue(); + in_value->Append(Value::CreateStringValue("test1")); + in_value->Append(Value::CreateStringValue("test2,")); + store.Apply(type, in_value); + ListValue* list = NULL; + EXPECT_TRUE(store.prefs()->GetList(pref_name, &list)); + ListValue::const_iterator current(list->begin()); + ListValue::const_iterator end(list->end()); + ASSERT_TRUE(current != end); + std::string value; + (*current)->GetAsString(&value); + EXPECT_EQ("test1", value); + ++current; + ASSERT_TRUE(current != end); + (*current)->GetAsString(&value); + EXPECT_EQ("test2,", value); + ++current; + EXPECT_TRUE(current == end); +} + +void ConfigurationPolicyPrefStoreTest::TestListPolicy( + const char* pref_name, ConfigurationPolicyStore::PolicyType type) { + TestListPolicyGetDefault(pref_name); + TestListPolicySetValue(pref_name, type); +} + void ConfigurationPolicyPrefStoreTest::TestStringPolicyGetDefault( const char* pref_name) { ConfigurationPolicyPrefStore store(NULL, NULL); @@ -147,6 +194,13 @@ TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyHomepageIsNewTabPage) { ConfigurationPolicyPrefStore::kPolicyHomepageIsNewTabPage); } +TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyRestoreOnStartup) { + TestIntegerPolicy(prefs::kRestoreOnStartup, + ConfigurationPolicyPrefStore::kPolicyRestoreOnStartup); + TestListPolicy(prefs::kURLsToRestoreOnStartup, + ConfigurationPolicyPrefStore::kPolicyURLsToRestoreOnStartup); +} + TEST_F(ConfigurationPolicyPrefStoreTest, TestPolicyAlternateErrorPagesEnabled) { TestBooleanPolicy(prefs::kAlternateErrorPagesEnabled, ConfigurationPolicyStore::kPolicyAlternateErrorPagesEnabled); diff --git a/chrome/browser/policy/configuration_policy_provider.cc b/chrome/browser/policy/configuration_policy_provider.cc index d24196b..342c011 100644 --- a/chrome/browser/policy/configuration_policy_provider.cc +++ b/chrome/browser/policy/configuration_policy_provider.cc @@ -24,6 +24,10 @@ const InternalPolicyValueMapEntry kPolicyValueMap[] = { Value::TYPE_STRING, policy::key::kHomepageLocation }, { ConfigurationPolicyStore::kPolicyHomepageIsNewTabPage, Value::TYPE_BOOLEAN, policy::key::kHomepageIsNewTabPage }, + { ConfigurationPolicyStore::kPolicyRestoreOnStartup, + Value::TYPE_INTEGER, policy::key::kRestoreOnStartup }, + { ConfigurationPolicyStore::kPolicyURLsToRestoreOnStartup, + Value::TYPE_LIST, policy::key::kURLsToRestoreOnStartup }, { ConfigurationPolicyStore::kPolicyProxyServerMode, Value::TYPE_INTEGER, policy::key::kProxyServerMode }, { ConfigurationPolicyStore::kPolicyProxyServer, diff --git a/chrome/browser/policy/configuration_policy_provider_win.cc b/chrome/browser/policy/configuration_policy_provider_win.cc index 2e5904e..5d79da6 100644 --- a/chrome/browser/policy/configuration_policy_provider_win.cc +++ b/chrome/browser/policy/configuration_policy_provider_win.cc @@ -58,31 +58,29 @@ ConfigurationPolicyProviderWin::ConfigurationPolicyProviderWin() { } bool ConfigurationPolicyProviderWin::GetRegistryPolicyString( - const string16& name, int index, string16* result) { - DWORD value_size = 0; - DWORD key_type = 0; - scoped_array<uint8> buffer; + const string16& name, string16* result) { + string16 path = string16(policy::kRegistrySubKey); RegKey policy_key; - string16 location = string16(policy::kRegistrySubKey); - string16 value_name = name; - - if (index > 0) { - // This is a list value, treat |name| as a subkey. - location += ASCIIToUTF16("\\") + name; - value_name = base::IntToString16(index); - } - // First try the global policy. - if (!policy_key.Open(HKEY_LOCAL_MACHINE, location.c_str()) || - !policy_key.ReadValue(value_name.c_str(), 0, &value_size, &key_type)) { + if (policy_key.Open(HKEY_LOCAL_MACHINE, path.c_str())) { + if (ReadRegistryStringValue(&policy_key, name, result)) + return true; policy_key.Close(); - // Fall back on user-specific policy. - if (!policy_key.Open(HKEY_CURRENT_USER, location.c_str()) || - !policy_key.ReadValue(value_name.c_str(), 0, &value_size, &key_type)) { - return false; - } } + // Fall back on user-specific policy. + if (!policy_key.Open(HKEY_CURRENT_USER, path.c_str())) + return false; + return ReadRegistryStringValue(&policy_key, name, result); +} +bool ConfigurationPolicyProviderWin::ReadRegistryStringValue( + RegKey* key, const string16& name, string16* result) { + DWORD value_size = 0; + DWORD key_type = 0; + scoped_array<uint8> buffer; + + if (!key->ReadValue(name.c_str(), 0, &value_size, &key_type)) + return false; if (key_type != REG_SZ) return false; @@ -92,18 +90,28 @@ bool ConfigurationPolicyProviderWin::GetRegistryPolicyString( // the 0-termination. buffer.reset(new uint8[value_size + 2]); memset(buffer.get(), 0, value_size + 2); - policy_key.ReadValue(value_name.c_str(), buffer.get(), &value_size); + key->ReadValue(name.c_str(), buffer.get(), &value_size); result->assign(reinterpret_cast<const wchar_t*>(buffer.get())); return true; } - bool ConfigurationPolicyProviderWin::GetRegistryPolicyStringList( const string16& key, ListValue* result) { - int index = 0; + string16 path = string16(policy::kRegistrySubKey); + path += ASCIIToUTF16("\\") + key; + RegKey policy_key; + if (!policy_key.Open(HKEY_LOCAL_MACHINE, path.c_str())) { + policy_key.Close(); + // Fall back on user-specific policy. + if (!policy_key.Open(HKEY_CURRENT_USER, path.c_str())) + return false; + } string16 policy_string; - while (GetRegistryPolicyString(key, ++index, &policy_string)) + int index = 0; + while (ReadRegistryStringValue(&policy_key, base::IntToString16(++index), + &policy_string)) { result->Append(Value::CreateStringValue(policy_string)); + } return true; } @@ -151,7 +159,7 @@ bool ConfigurationPolicyProviderWin::Provide( switch (current->value_type) { case Value::TYPE_STRING: { std::wstring string_value; - if (GetRegistryPolicyString(name.c_str(), -1, &string_value)) { + if (GetRegistryPolicyString(name.c_str(), &string_value)) { store->Apply(current->policy_type, Value::CreateStringValue(string_value)); } diff --git a/chrome/browser/policy/configuration_policy_provider_win.h b/chrome/browser/policy/configuration_policy_provider_win.h index e197e9d..59a2770 100644 --- a/chrome/browser/policy/configuration_policy_provider_win.h +++ b/chrome/browser/policy/configuration_policy_provider_win.h @@ -12,6 +12,8 @@ #include "chrome/browser/policy/configuration_policy_store.h" #include "chrome/browser/policy/configuration_policy_provider.h" +class RegKey; + // An implementation of |ConfigurationPolicyProvider| using the // mechanism provided by Windows Groups Policy. Policy decisions are // stored as values in a special section of the Windows Registry. @@ -54,15 +56,12 @@ class ConfigurationPolicyProviderWin : public ConfigurationPolicyProvider { // Methods to perform type-specific policy lookups in the registry. // HKLM is checked first, then HKCU. - // Reads a string registry value |name| and puts the resulting string in - // |result|. If |index| > 0, |name| is the name of a subkey and the value - // read is named |index|. Note: A subkey is used for lists to work around - // a problem with the Group Policy Editor, where one list value overwrites - // another if they appear under the same key (even if they have different - // names). - bool GetRegistryPolicyString(const string16& name, - int index, + // Reads a string registry value |name| at the specified |key| and puts the + // resulting string in |result|. + bool ReadRegistryStringValue(RegKey* key, const string16& name, string16* result); + + bool GetRegistryPolicyString(const string16& name, string16* result); // Gets a list value contained under |key| one level below the policy root. bool GetRegistryPolicyStringList(const string16& key, ListValue* result); bool GetRegistryPolicyBoolean(const string16& value_name, bool* result); diff --git a/chrome/browser/policy/configuration_policy_store.h b/chrome/browser/policy/configuration_policy_store.h index e74fe6c..2612c4d 100644 --- a/chrome/browser/policy/configuration_policy_store.h +++ b/chrome/browser/policy/configuration_policy_store.h @@ -20,6 +20,8 @@ class ConfigurationPolicyStore { enum PolicyType { kPolicyHomePage, kPolicyHomepageIsNewTabPage, + kPolicyRestoreOnStartup, + kPolicyURLsToRestoreOnStartup, kPolicyProxyServerMode, kPolicyProxyServer, kPolicyProxyPacUrl, diff --git a/chrome/browser/policy/managed_prefs_banner_base.cc b/chrome/browser/policy/managed_prefs_banner_base.cc index fc334f8..b9d4d83 100644 --- a/chrome/browser/policy/managed_prefs_banner_base.cc +++ b/chrome/browser/policy/managed_prefs_banner_base.cc @@ -52,6 +52,8 @@ void ManagedPrefsBannerBase::Init(PrefService* local_state, AddUserPref(prefs::kHomePage); AddUserPref(prefs::kHomePageIsNewTabPage); AddUserPref(prefs::kShowHomeButton); + AddUserPref(prefs::kRestoreOnStartup); + AddUserPref(prefs::kURLsToRestoreOnStartup); break; case OPTIONS_PAGE_CONTENT: AddUserPref(prefs::kSyncManaged); diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc index 827af01..87d321b 100644 --- a/chrome/browser/prefs/session_startup_pref.cc +++ b/chrome/browser/prefs/session_startup_pref.cc @@ -61,19 +61,23 @@ void SessionStartupPref::SetStartupPref( void SessionStartupPref::SetStartupPref(PrefService* prefs, const SessionStartupPref& pref) { DCHECK(prefs); - prefs->SetInteger(prefs::kRestoreOnStartup, TypeToPrefValue(pref.type)); - - // Always save the URLs, that way the UI can remain consistent even if the - // user changes the startup type pref. - // Ownership of the ListValue retains with the pref service. - ScopedPrefUpdate update(prefs, prefs::kURLsToRestoreOnStartup); - ListValue* url_pref_list = - prefs->GetMutableList(prefs::kURLsToRestoreOnStartup); - DCHECK(url_pref_list); - url_pref_list->Clear(); - for (size_t i = 0; i < pref.urls.size(); ++i) { - url_pref_list->Set(static_cast<int>(i), - new StringValue(pref.urls[i].spec())); + + if (!SessionStartupPref::TypeIsManaged(prefs)) + prefs->SetInteger(prefs::kRestoreOnStartup, TypeToPrefValue(pref.type)); + + if (!SessionStartupPref::URLsAreManaged(prefs)) { + // Always save the URLs, that way the UI can remain consistent even if the + // user changes the startup type pref. + // Ownership of the ListValue retains with the pref service. + ScopedPrefUpdate update(prefs, prefs::kURLsToRestoreOnStartup); + ListValue* url_pref_list = + prefs->GetMutableList(prefs::kURLsToRestoreOnStartup); + DCHECK(url_pref_list); + url_pref_list->Clear(); + for (size_t i = 0; i < pref.urls.size(); ++i) { + url_pref_list->Set(static_cast<int>(i), + new StringValue(pref.urls[i].spec())); + } } } @@ -102,6 +106,24 @@ SessionStartupPref SessionStartupPref::GetStartupPref(PrefService* prefs) { pref.urls.push_back(GURL(url_text)); } } - return pref; } + +// static +bool SessionStartupPref::TypeIsManaged(PrefService* prefs) { + DCHECK(prefs); + const PrefService::Preference* pref_restore = + prefs->FindPreference(prefs::kRestoreOnStartup); + DCHECK(pref_restore); + return pref_restore->IsManaged(); +} + +// static +bool SessionStartupPref::URLsAreManaged(PrefService* prefs) { + DCHECK(prefs); + const PrefService::Preference* pref_urls = + prefs->FindPreference(prefs::kURLsToRestoreOnStartup); + DCHECK(pref_urls); + return pref_urls->IsManaged(); +} + diff --git a/chrome/browser/prefs/session_startup_pref.h b/chrome/browser/prefs/session_startup_pref.h index a2a1660..d7cfaac 100644 --- a/chrome/browser/prefs/session_startup_pref.h +++ b/chrome/browser/prefs/session_startup_pref.h @@ -37,6 +37,10 @@ struct SessionStartupPref { static SessionStartupPref GetStartupPref(Profile* profile); static SessionStartupPref GetStartupPref(PrefService* prefs); + // Whether the startup type and URLs are managed via policy. + static bool TypeIsManaged(PrefService* prefs); + static bool URLsAreManaged(PrefService* prefs); + SessionStartupPref() : type(DEFAULT) {} explicit SessionStartupPref(Type type) : type(type) {} diff --git a/chrome/browser/views/options/general_page_view.cc b/chrome/browser/views/options/general_page_view.cc index 0db006c..d8ae49b 100644 --- a/chrome/browser/views/options/general_page_view.cc +++ b/chrome/browser/views/options/general_page_view.cc @@ -350,38 +350,33 @@ void GeneralPageView::InitControlLayout() { } void GeneralPageView::NotifyPrefChanged(const std::string* pref_name) { - if (!pref_name || *pref_name == prefs::kRestoreOnStartup) { + if (!pref_name || + *pref_name == prefs::kRestoreOnStartup || + *pref_name == prefs::kURLsToRestoreOnStartup) { PrefService* prefs = profile()->GetPrefs(); const SessionStartupPref startup_pref = SessionStartupPref::GetStartupPref(prefs); + bool radio_buttons_enabled = !SessionStartupPref::TypeIsManaged(prefs); + bool restore_urls_enabled = !SessionStartupPref::URLsAreManaged(prefs); switch (startup_pref.type) { case SessionStartupPref::DEFAULT: startup_homepage_radio_->SetChecked(true); - EnableCustomHomepagesControls(false); + restore_urls_enabled = false; break; case SessionStartupPref::LAST: startup_last_session_radio_->SetChecked(true); - EnableCustomHomepagesControls(false); + restore_urls_enabled = false; break; case SessionStartupPref::URLS: startup_custom_radio_->SetChecked(true); - EnableCustomHomepagesControls(true); break; } - } - - // TODO(beng): Note that the kURLsToRestoreOnStartup pref is a mutable list, - // and changes to mutable lists aren't broadcast through the - // observer system, so the second half of this condition will - // never match. Once support for broadcasting such updates is - // added, this will automagically start to work, and this comment - // can be removed. - if (!pref_name || *pref_name == prefs::kURLsToRestoreOnStartup) { - PrefService* prefs = profile()->GetPrefs(); - const SessionStartupPref startup_pref = - SessionStartupPref::GetStartupPref(prefs); + startup_homepage_radio_->SetEnabled(radio_buttons_enabled); + startup_last_session_radio_->SetEnabled(radio_buttons_enabled); + startup_custom_radio_->SetEnabled(radio_buttons_enabled); + EnableCustomHomepagesControls(restore_urls_enabled); startup_custom_pages_table_model_->SetURLs(startup_pref.urls); } @@ -735,6 +730,11 @@ void GeneralPageView::EnableCustomHomepagesControls(bool enable) { void GeneralPageView::AddBookmark(UrlPicker* dialog, const std::wstring& title, const GURL& url) { + // The restore URLs policy might have become managed while the dialog is + // displayed. While the model makes sure that no changes are made in this + // condition, we should still avoid changing the graphic elements. + if (SessionStartupPref::URLsAreManaged(profile()->GetPrefs())) + return; int index = startup_custom_pages_table_->FirstSelectedRow(); if (index == -1) index = startup_custom_pages_table_model_->RowCount(); diff --git a/chrome/common/policy_constants.cc b/chrome/common/policy_constants.cc index 65bd48c..2a03f2e 100644 --- a/chrome/common/policy_constants.cc +++ b/chrome/common/policy_constants.cc @@ -18,6 +18,8 @@ namespace key { const char kHomepageLocation[] = "HomepageLocation"; const char kHomepageIsNewTabPage[] = "HomepageIsNewTabPage"; +const char kRestoreOnStartup[] = "RestoreOnStartup"; +const char kURLsToRestoreOnStartup[] = "RestoreOnStartupURLs"; const char kProxyServerMode[] = "ProxyServerMode"; const char kProxyServer[] = "ProxyServer"; const char kProxyPacUrl[] = "ProxyPacUrl"; diff --git a/chrome/common/policy_constants.h b/chrome/common/policy_constants.h index b00dac2..ce30b59 100644 --- a/chrome/common/policy_constants.h +++ b/chrome/common/policy_constants.h @@ -20,6 +20,8 @@ namespace key { extern const char kHomepageLocation[]; extern const char kHomepageIsNewTabPage[]; +extern const char kRestoreOnStartup[]; +extern const char kURLsToRestoreOnStartup[]; extern const char kProxyServerMode[]; extern const char kProxyServer[]; extern const char kProxyPacUrl[]; |