diff options
author | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-03 23:52:03 +0000 |
---|---|---|
committer | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-03 23:52:03 +0000 |
commit | f253006b157f9c917fba21a7312290aaa2e889e7 (patch) | |
tree | 377183f9511bed141b5fd7a706c3407a122540d9 | |
parent | dadacf06556b4f63a62ec3cea91d7fc5abccd67c (diff) | |
download | chromium_src-f253006b157f9c917fba21a7312290aaa2e889e7.zip chromium_src-f253006b157f9c917fba21a7312290aaa2e889e7.tar.gz chromium_src-f253006b157f9c917fba21a7312290aaa2e889e7.tar.bz2 |
Chromium-MultiProfile-Prototype
Summary
=======
Implement a prototype of multiple profiles in Chrome by
utilizing the functionality of user-data-dir command line
flag that already exists.
A profile in this case is an umbrella for all user data
including cookies, history, bookmarks, settings, etc. Each
profile gives the user a separation of all these data
elements.
User Interface
==============
- Wrench > "New window in profile" menu item, with sub-menu items.
This new menu item has sub menu items for each existing
profile, for up to 9 profiles, and one more sub menu item
to launch a window in a new profile. The 9 sub-menu items
also have the accelerators like CTRL + SHIFT + 1, CTRL +
SHIFT + 2, etc. If there are more than 9 profiles, we
will also show an extra sub-menu item, "Other...".
- New Profile dialog box
This dialog box is shown to the use when (s)he clicks
Wrench > New window in profile > <New Profile>. It lets
the user specify a profile name, and also shows a checkbox
to create a desktop shortcut to launch Chrome in that profile.
- Choose profile dialog box
This dialog box lets the user select a profile from a drop
down to open a new window in. It also has an item <New Profile>
in the drop down, selecting which will show the new profile
dialog box mentioned above. CTRL + M shortcut also launches
this dialog box.
Code Organization
=================
chrome\browser\user_data_dir_profile_manager.h/.cc:
This class provides an abstraction of profiles on top of the user
data dir command line flag.
chrome\browser\views\user_data_dir_new_profile_dialog.h/.cc
New profile dialog box code.
chrome\browser\views\user_data_dir_profiles_dialog.h/.cc
Choose profile dialog box code.
Review URL: http://codereview.chromium.org/12895
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6333 0039d316-1c4b-4281-b951-d872f2087c98
77 files changed, 1376 insertions, 19 deletions
diff --git a/chrome/app/chrome_dll.rc b/chrome/app/chrome_dll.rc index c8688f5..14bcf23 100644 --- a/chrome/app/chrome_dll.rc +++ b/chrome/app/chrome_dll.rc @@ -54,6 +54,29 @@ BEGIN VK_F1, IDC_HELPMENU, VIRTKEY "T", IDC_NEWTAB, VIRTKEY, CONTROL "N", IDC_NEWWINDOW, VIRTKEY, CONTROL + // CTRL + M is used for opening the dialog to let the user select + // a profile to open a new window. + // CTRL + SHIFT + N (N = 1 to 9) is used to let the user open a new + // window in profile 1 to profile 9 directly. + "M", IDC_NEWPROFILEWINDOW, VIRTKEY, CONTROL + "1", IDC_NEWPROFILEWINDOW_PROFILE1, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD1, IDC_NEWPROFILEWINDOW_PROFILE1, VIRTKEY, CONTROL, SHIFT + "2", IDC_NEWPROFILEWINDOW_PROFILE2, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD2, IDC_NEWPROFILEWINDOW_PROFILE2, VIRTKEY, CONTROL, SHIFT + "3", IDC_NEWPROFILEWINDOW_PROFILE3, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD3, IDC_NEWPROFILEWINDOW_PROFILE3, VIRTKEY, CONTROL, SHIFT + "4", IDC_NEWPROFILEWINDOW_PROFILE4, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD4, IDC_NEWPROFILEWINDOW_PROFILE4, VIRTKEY, CONTROL, SHIFT + "5", IDC_NEWPROFILEWINDOW_PROFILE5, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD5, IDC_NEWPROFILEWINDOW_PROFILE5, VIRTKEY, CONTROL, SHIFT + "6", IDC_NEWPROFILEWINDOW_PROFILE6, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD6, IDC_NEWPROFILEWINDOW_PROFILE6, VIRTKEY, CONTROL, SHIFT + "7", IDC_NEWPROFILEWINDOW_PROFILE7, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD7, IDC_NEWPROFILEWINDOW_PROFILE7, VIRTKEY, CONTROL, SHIFT + "8", IDC_NEWPROFILEWINDOW_PROFILE8, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD8, IDC_NEWPROFILEWINDOW_PROFILE8, VIRTKEY, CONTROL, SHIFT + "9", IDC_NEWPROFILEWINDOW_PROFILE9, VIRTKEY, CONTROL, SHIFT + VK_NUMPAD9, IDC_NEWPROFILEWINDOW_PROFILE9, VIRTKEY, CONTROL, SHIFT "N", IDC_GOOFFTHERECORD, VIRTKEY, CONTROL, SHIFT "O", IDC_OPENFILE, VIRTKEY, CONTROL "P", IDC_PRINT, VIRTKEY, CONTROL diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h index e26b47c..7b57ade 100644 --- a/chrome/app/chrome_dll_resource.h +++ b/chrome/app/chrome_dll_resource.h @@ -154,6 +154,27 @@ // Reserve space for 100 Spell Check languages - currently we have 30. #define IDC_SPELLCHECKER_LANGUAGE_FIRST 32954 #define IDC_SPELLCHECKER_LANGUAGE_LAST 33054 +// We have a menu item for opening a new window in a specific profile, and it +// has dynamic number of sub menu items. The number of sub menu items depends on +// the number of existing profiles. But we only show menu items for nine +// different profiles, plus a menu item for other than the nine profiles (if +// there are more than nine profiles), plus a menu item for new profile. +#define IDC_NEWPROFILEWINDOW 33055 +#define IDC_SELECT_PROFILE 33056 +#define IDC_NEW_PROFILE 33057 +// Define menu IDs for nine profiles to provide accelarators like CTRL + +// SHIFT + 1, CTRL + SHIFT + 2, etc. for them. +#define IDC_NEWPROFILEWINDOW_PROFILE1 33058 +#define IDC_NEWPROFILEWINDOW_PROFILE2 33059 +#define IDC_NEWPROFILEWINDOW_PROFILE3 33060 +#define IDC_NEWPROFILEWINDOW_PROFILE4 33061 +#define IDC_NEWPROFILEWINDOW_PROFILE5 33062 +#define IDC_NEWPROFILEWINDOW_PROFILE6 33063 +#define IDC_NEWPROFILEWINDOW_PROFILE7 33064 +#define IDC_NEWPROFILEWINDOW_PROFILE8 33065 +#define IDC_NEWPROFILEWINDOW_PROFILE9 33066 +#define IDC_NEWPROFILEWINDOW_MIN_ID IDC_NEWPROFILEWINDOW_PROFILE1 +#define IDC_NEWPROFILEWINDOW_MAX_ID IDC_NEWPROFILEWINDOW_PROFILE9 // Next default values for new objects // @@ -161,7 +182,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 3001 -#define _APS_NEXT_COMMAND_VALUE 32947 +#define _APS_NEXT_COMMAND_VALUE 33067 #define _APS_NEXT_CONTROL_VALUE 4017 #define _APS_NEXT_SYMED_VALUE 1001 #endif diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 61461f3..90263f6 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd @@ -256,6 +256,9 @@ be available for now. --> <message name="IDS_IMPORT_BOOKMARKS" desc="Explanatory text for the importing progress dialog when importing a bookmarks.html file from the bookmark manager"> Chromium is now importing Favorites/Bookmarks. </message> + <message name="IDS_START_IN_PROFILE_SHORTCUT_NAME" desc="Name of the desktop shortcut to start the application in a specific profile."> + Chromium for <ph name="profile_name">$1</ph> + </message> </messages> </release> </grit> diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 457e428..33e8fd4 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -361,6 +361,12 @@ each locale. --> <message name="IDS_NEWWINDOW" desc="The text label of the New Window menu item" > &New window </message> + <message name="IDS_NEWPROFILEWINDOW" desc="The text label of the New profile Window menu item" > + New window in &profile + </message> + <message name="IDS_NEWPROFILEWINDOW_OTHERPROFILE" desc="The text label of the sub menu item of New profile Window menu item to select a profile other than the ones displayed in the sub-menu items." > + Other... + </message> <message name="IDS_GOOFFTHERECORD" desc="The text label of the New incognito window menu item"> New &incognito window </message> @@ -2834,10 +2840,18 @@ each locale. --> desc="Title of the new tab page, this is only shown while loading, then the title comes from the page"> New Tab </message> + <message name="IDS_NEW_TAB_TITLE_WITH_PROFILE_NAME" + desc="Title of the new tab page with profile name, this is only shown while loading, then the title comes from the page"> + New Tab [<ph name="PROFILE_NAME">$1</ph>] + </message> <message name="IDS_NEW_TAB_MOST_VISITED" desc="The 'Most Visited' heading on the new tab page"> Most visited </message> + <message name="IDS_NEW_TAB_MOST_VISITED_WITH_PROFILE_NAME" + desc="The 'Most Visited' heading on the new tab page"> + Most visited [<ph name="PROFILE_NAME">$1</ph>] + </message> <message name="IDS_NEW_TAB_SEARCHES" desc="The 'Searches' heading on the new tab page"> Searches @@ -3144,7 +3158,29 @@ each locale. --> <message name="IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON" desc="Text on button that opens another dialog to choose a new directory for user data."> Choose Another Directory... </message> - + + <!-- User data directory profiles dialog --> + <message name="IDS_SELECT_PROFILE_DIALOG_TITLE" desc="Title of the dialog that lets the user select a profile to open a new window."> + Select a Profile + </message> + <message name="IDS_SELECT_PROFILE_DIALOG_LABEL_TEXT" desc="The label for the combo box that shows all the available profiles."> + Select a profile to open a new window + </message> + <message name="IDS_SELECT_PROFILE_DIALOG_NEW_PROFILE_ENTRY" desc="Text for an extra entry in the profiles combo box. The user can select this entry to create a new profile."> + <New Profile>... + </message> + + <!-- User data directory new profile dialog --> + <message name="IDS_NEW_PROFILE_DIALOG_TITLE" desc="Title of dialog that lets the user enter a new profile name to open new window."> + Enter a Profile Name + </message> + <message name="IDS_NEW_PROFILE_DIALOG_LABEL_TEXT" desc="The label for the text box that lets the user enter a new profile name."> + Enter a new profile name + </message> + <message name="IDS_NEW_PROFILE_DIALOG_CREATE_SHORTCUT_TEXT" desc="The label for the text box that lets the user enter a new profile name."> + Create a desktop shortcut for this profile + </message> + <!-- Advanced Section Titles --> <message name="IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY"> Privacy diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index b240a49..52c9878 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd @@ -296,6 +296,9 @@ Chrome supports. --> <message name="IDS_IMPORT_BOOKMARKS" desc="Explanatory text for the importing progress dialog when importing a bookmarks.html file from the bookmark manager"> Google Chrome is now importing Favorites/Bookmarks. </message> + <message name="IDS_START_IN_PROFILE_SHORTCUT_NAME" desc="Name of the desktop shortcut to start the application in a specific profile."> + Google Chrome for <ph name="profile_name">$1</ph> + </message> </messages> </release> </grit> diff --git a/chrome/app/locales/locale_settings.h b/chrome/app/locales/locale_settings.h index 55400a0..10893bc 100644 --- a/chrome/app/locales/locale_settings.h +++ b/chrome/app/locales/locale_settings.h @@ -172,3 +172,11 @@ // The language dependent download view size. #define IDS_DOWNLOAD_BIG_PROGRESS_SIZE 1064 + +// The width and height of the Select Profile dialog in characters and lines +// (See above). +#define IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS 1065 +#define IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES 1066 + +// The width of the New Profile dialog in characters (See above). +#define IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS 1067 diff --git a/chrome/app/resources/locale_settings_ar.rc b/chrome/app/resources/locale_settings_ar.rc index 7581e4a..e888878 100644 --- a/chrome/app/resources/locale_settings_ar.rc +++ b/chrome/app/resources/locale_settings_ar.rc @@ -64,6 +64,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_bg.rc b/chrome/app/resources/locale_settings_bg.rc index 12500ef..1955bd6 100644 --- a/chrome/app/resources/locale_settings_bg.rc +++ b/chrome/app/resources/locale_settings_bg.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_bn.rc b/chrome/app/resources/locale_settings_bn.rc index ad1904e..5bd9cf5 100644 --- a/chrome/app/resources/locale_settings_bn.rc +++ b/chrome/app/resources/locale_settings_bn.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_ca.rc b/chrome/app/resources/locale_settings_ca.rc index 9ff0599..6793ed6 100644 --- a/chrome/app/resources/locale_settings_ca.rc +++ b/chrome/app/resources/locale_settings_ca.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_cs.rc b/chrome/app/resources/locale_settings_cs.rc index da34bae..53419e9 100644 --- a/chrome/app/resources/locale_settings_cs.rc +++ b/chrome/app/resources/locale_settings_cs.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_da.rc b/chrome/app/resources/locale_settings_da.rc index c7bf9a1..4c95be0 100644 --- a/chrome/app/resources/locale_settings_da.rc +++ b/chrome/app/resources/locale_settings_da.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_de.rc b/chrome/app/resources/locale_settings_de.rc index 82bd540..3b12d46 100644 --- a/chrome/app/resources/locale_settings_de.rc +++ b/chrome/app/resources/locale_settings_de.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60"" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_el.rc b/chrome/app/resources/locale_settings_el.rc index 14b9ee0..6792771 100644 --- a/chrome/app/resources/locale_settings_el.rc +++ b/chrome/app/resources/locale_settings_el.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_en-GB.rc b/chrome/app/resources/locale_settings_en-GB.rc index 1cfb108..7f1bb1d 100644 --- a/chrome/app/resources/locale_settings_en-GB.rc +++ b/chrome/app/resources/locale_settings_en-GB.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_en-US.rc b/chrome/app/resources/locale_settings_en-US.rc index 397b32a..5186bee 100644 --- a/chrome/app/resources/locale_settings_en-US.rc +++ b/chrome/app/resources/locale_settings_en-US.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_es-419.rc b/chrome/app/resources/locale_settings_es-419.rc index f5af996..9c9395a 100644 --- a/chrome/app/resources/locale_settings_es-419.rc +++ b/chrome/app/resources/locale_settings_es-419.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_es.rc b/chrome/app/resources/locale_settings_es.rc index c308cea..2108c29 100644 --- a/chrome/app/resources/locale_settings_es.rc +++ b/chrome/app/resources/locale_settings_es.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_et.rc b/chrome/app/resources/locale_settings_et.rc index 383d0f4..bb24574 100644 --- a/chrome/app/resources/locale_settings_et.rc +++ b/chrome/app/resources/locale_settings_et.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_fi.rc b/chrome/app/resources/locale_settings_fi.rc index 862b6fe..fba320c 100644 --- a/chrome/app/resources/locale_settings_fi.rc +++ b/chrome/app/resources/locale_settings_fi.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_fil.rc b/chrome/app/resources/locale_settings_fil.rc index 4c04b9d..69f4373 100644 --- a/chrome/app/resources/locale_settings_fil.rc +++ b/chrome/app/resources/locale_settings_fil.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_fr.rc b/chrome/app/resources/locale_settings_fr.rc index 3f4e017..8bd357d 100644 --- a/chrome/app/resources/locale_settings_fr.rc +++ b/chrome/app/resources/locale_settings_fr.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_gu.rc b/chrome/app/resources/locale_settings_gu.rc index b660298..edcb4f4 100644 --- a/chrome/app/resources/locale_settings_gu.rc +++ b/chrome/app/resources/locale_settings_gu.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_he.rc b/chrome/app/resources/locale_settings_he.rc index f755267..6935171 100644 --- a/chrome/app/resources/locale_settings_he.rc +++ b/chrome/app/resources/locale_settings_he.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_hi.rc b/chrome/app/resources/locale_settings_hi.rc index 56eba16..c54e290 100644 --- a/chrome/app/resources/locale_settings_hi.rc +++ b/chrome/app/resources/locale_settings_hi.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_hr.rc b/chrome/app/resources/locale_settings_hr.rc index 2a471bf..8addb25 100644 --- a/chrome/app/resources/locale_settings_hr.rc +++ b/chrome/app/resources/locale_settings_hr.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_hu.rc b/chrome/app/resources/locale_settings_hu.rc index 059506c..6510f4e 100644 --- a/chrome/app/resources/locale_settings_hu.rc +++ b/chrome/app/resources/locale_settings_hu.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_id.rc b/chrome/app/resources/locale_settings_id.rc index 65f3e64..696e573 100644 --- a/chrome/app/resources/locale_settings_id.rc +++ b/chrome/app/resources/locale_settings_id.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_it.rc b/chrome/app/resources/locale_settings_it.rc index da184e6..6432c09 100644 --- a/chrome/app/resources/locale_settings_it.rc +++ b/chrome/app/resources/locale_settings_it.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_ja.rc b/chrome/app/resources/locale_settings_ja.rc index 22dc046..891cff5 100644 --- a/chrome/app/resources/locale_settings_ja.rc +++ b/chrome/app/resources/locale_settings_ja.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_kn.rc b/chrome/app/resources/locale_settings_kn.rc index 4ecbf42..9f40b0d 100644 --- a/chrome/app/resources/locale_settings_kn.rc +++ b/chrome/app/resources/locale_settings_kn.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_ko.rc b/chrome/app/resources/locale_settings_ko.rc index 9af15c1..eab059a 100644 --- a/chrome/app/resources/locale_settings_ko.rc +++ b/chrome/app/resources/locale_settings_ko.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_lt.rc b/chrome/app/resources/locale_settings_lt.rc index 30e6837..23601db 100644 --- a/chrome/app/resources/locale_settings_lt.rc +++ b/chrome/app/resources/locale_settings_lt.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_lv.rc b/chrome/app/resources/locale_settings_lv.rc index e60f3ee..fb73175 100644 --- a/chrome/app/resources/locale_settings_lv.rc +++ b/chrome/app/resources/locale_settings_lv.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_ml.rc b/chrome/app/resources/locale_settings_ml.rc index 50720c1..0f95134 100644 --- a/chrome/app/resources/locale_settings_ml.rc +++ b/chrome/app/resources/locale_settings_ml.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_mr.rc b/chrome/app/resources/locale_settings_mr.rc index fdc1944..1bf1492 100644 --- a/chrome/app/resources/locale_settings_mr.rc +++ b/chrome/app/resources/locale_settings_mr.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_nb.rc b/chrome/app/resources/locale_settings_nb.rc index 9293e4c..1689766 100644 --- a/chrome/app/resources/locale_settings_nb.rc +++ b/chrome/app/resources/locale_settings_nb.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_nl.rc b/chrome/app/resources/locale_settings_nl.rc index a00f015..7b18eba7 100644 --- a/chrome/app/resources/locale_settings_nl.rc +++ b/chrome/app/resources/locale_settings_nl.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_or.rc b/chrome/app/resources/locale_settings_or.rc index 72a263b..2288c3e 100644 --- a/chrome/app/resources/locale_settings_or.rc +++ b/chrome/app/resources/locale_settings_or.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_pl.rc b/chrome/app/resources/locale_settings_pl.rc index 05a9aa6..241dec8 100644 --- a/chrome/app/resources/locale_settings_pl.rc +++ b/chrome/app/resources/locale_settings_pl.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_pt-BR.rc b/chrome/app/resources/locale_settings_pt-BR.rc index edcc8d3..de9c9491 100644 --- a/chrome/app/resources/locale_settings_pt-BR.rc +++ b/chrome/app/resources/locale_settings_pt-BR.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_pt-PT.rc b/chrome/app/resources/locale_settings_pt-PT.rc index 45a0eb1..5f3f90b 100644 --- a/chrome/app/resources/locale_settings_pt-PT.rc +++ b/chrome/app/resources/locale_settings_pt-PT.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "66" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_ro.rc b/chrome/app/resources/locale_settings_ro.rc index 87ac6f8..d2a2aa9 100644 --- a/chrome/app/resources/locale_settings_ro.rc +++ b/chrome/app/resources/locale_settings_ro.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_ru.rc b/chrome/app/resources/locale_settings_ru.rc index 21341ea..def6b43 100644 --- a/chrome/app/resources/locale_settings_ru.rc +++ b/chrome/app/resources/locale_settings_ru.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_sk.rc b/chrome/app/resources/locale_settings_sk.rc index f1f9ab6..9f81238 100644 --- a/chrome/app/resources/locale_settings_sk.rc +++ b/chrome/app/resources/locale_settings_sk.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_sl.rc b/chrome/app/resources/locale_settings_sl.rc index f66d727..472d57d 100644 --- a/chrome/app/resources/locale_settings_sl.rc +++ b/chrome/app/resources/locale_settings_sl.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_sr.rc b/chrome/app/resources/locale_settings_sr.rc index 55a30d5..33948c2 100644 --- a/chrome/app/resources/locale_settings_sr.rc +++ b/chrome/app/resources/locale_settings_sr.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_sv.rc b/chrome/app/resources/locale_settings_sv.rc index 183eb9e..4ed700b 100644 --- a/chrome/app/resources/locale_settings_sv.rc +++ b/chrome/app/resources/locale_settings_sv.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_ta.rc b/chrome/app/resources/locale_settings_ta.rc index 9e67ed7..35d190e 100644 --- a/chrome/app/resources/locale_settings_ta.rc +++ b/chrome/app/resources/locale_settings_ta.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_te.rc b/chrome/app/resources/locale_settings_te.rc index a7f328f..835c230 100644 --- a/chrome/app/resources/locale_settings_te.rc +++ b/chrome/app/resources/locale_settings_te.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_th.rc b/chrome/app/resources/locale_settings_th.rc index 81cf895..0f4087d 100644 --- a/chrome/app/resources/locale_settings_th.rc +++ b/chrome/app/resources/locale_settings_th.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_tr.rc b/chrome/app/resources/locale_settings_tr.rc index 9d5cdb3..6e00ed1 100644 --- a/chrome/app/resources/locale_settings_tr.rc +++ b/chrome/app/resources/locale_settings_tr.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "66" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_uk.rc b/chrome/app/resources/locale_settings_uk.rc index 5d7d5c4..8c06402 100644 --- a/chrome/app/resources/locale_settings_uk.rc +++ b/chrome/app/resources/locale_settings_uk.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_vi.rc b/chrome/app/resources/locale_settings_vi.rc index e37abba..d5264a5 100644 --- a/chrome/app/resources/locale_settings_vi.rc +++ b/chrome/app/resources/locale_settings_vi.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_zh-CN.rc b/chrome/app/resources/locale_settings_zh-CN.rc index 03ae854..aef6ec4 100644 --- a/chrome/app/resources/locale_settings_zh-CN.rc +++ b/chrome/app/resources/locale_settings_zh-CN.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/app/resources/locale_settings_zh-TW.rc b/chrome/app/resources/locale_settings_zh-TW.rc index 3ed1132..8d95638 100644 --- a/chrome/app/resources/locale_settings_zh-TW.rc +++ b/chrome/app/resources/locale_settings_zh-TW.rc @@ -63,6 +63,9 @@ BEGIN IDS_BOOKMARK_MANAGER_DIALOG_WIDTH_CHARS "150" IDS_BOOKMARK_MANAGER_DIALOG_HEIGHT_LINES "40" IDS_DOWNLOAD_BIG_PROGRESS_SIZE "52" + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS "60" + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES "5" + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS "60" END #if defined(GOOGLE_CHROME_BUILD) diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 10e912c..ad297be 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -37,11 +37,14 @@ #include "chrome/browser/site_instance.h" #include "chrome/browser/task_manager.h" #include "chrome/browser/url_fixer_upper.h" +#include "chrome/browser/user_data_manager.h" #include "chrome/browser/user_metrics.h" #include "chrome/browser/view_ids.h" #include "chrome/browser/views/download_tab_view.h" #include "chrome/browser/views/go_button.h" #include "chrome/browser/views/location_bar_view.h" +#include "chrome/browser/views/new_profile_dialog.h" +#include "chrome/browser/views/select_profile_dialog.h" #include "chrome/browser/views/status_bubble.h" #include "chrome/browser/views/toolbar_star_toggle.h" #include "chrome/browser/web_contents_view.h" @@ -654,6 +657,26 @@ void Browser::NewWindow() { Browser::OpenEmptyWindow(profile_->GetOriginalProfile()); } +void Browser::OpenSelectProfileDialog() { + UserMetrics::RecordAction(L"SelectProfile", profile_); + SelectProfileDialog::RunDialog(); +} + +void Browser::OpenNewProfileDialog() { + UserMetrics::RecordAction(L"CreateProfile", profile_); + NewProfileDialog::RunDialog(); +} + +void Browser::NewProfileWindowByName(const std::wstring& profile) { + UserMetrics::RecordAction(L"NewProfileWindowByName", profile_); + UserDataManager::Get()->LaunchChromeForProfile(profile); +} + +void Browser::NewProfileWindowByIndex(int index) { + UserMetrics::RecordAction(L"NewProfileWindowByIndex", profile_); + UserDataManager::Get()->LaunchChromeForProfile(index); +} + void Browser::NewIncognitoWindow() { UserMetrics::RecordAction(L"NewIncognitoWindow", profile_); Browser::OpenEmptyWindow(profile_->GetOffTheRecordProfile()); @@ -1182,9 +1205,21 @@ void Browser::ExecuteCommand(int id) { case IDC_SHOW_DOWNLOADS: ShowDownloadsTab(); break; case IDC_SHOW_BOOKMARK_MANAGER: OpenBookmarksManager(); break; case IDC_SHOW_BOOKMARKS_BAR: ToggleBookmarksBar(); break; + case IDC_NEWPROFILEWINDOW: + case IDC_SELECT_PROFILE: + OpenSelectProfileDialog(); + break; + case IDC_NEW_PROFILE: OpenNewProfileDialog(); break; default: - LOG(WARNING) << "Received Unimplemented Command: " << id; + // Handle the user action for creating a new window in a specific profile. + if (id >= IDC_NEWPROFILEWINDOW_MIN_ID && + id <= IDC_NEWPROFILEWINDOW_MAX_ID) { + int index = id - IDC_NEWPROFILEWINDOW_MIN_ID; + NewProfileWindowByIndex(index); + } else { + LOG(WARNING) << "Received Unimplemented Command: " << id; + } break; } } @@ -2016,6 +2051,16 @@ void Browser::UpdateNavigationCommands() { !current_tab->GetFavIcon().isNull()); controller_.UpdateCommandEnabled(IDC_DUPLICATE, CanDuplicateContentsAt(selected_index())); + + // Enable various IDC_NEWPROFILEWINDOW* commands. + controller_.UpdateCommandEnabled(IDC_NEWPROFILEWINDOW, true); + controller_.UpdateCommandEnabled(IDC_SELECT_PROFILE, true); + controller_.UpdateCommandEnabled(IDC_NEW_PROFILE, true); + for (int i = IDC_NEWPROFILEWINDOW_MIN_ID; + i <= IDC_NEWPROFILEWINDOW_MAX_ID; + ++i) { + controller_.UpdateCommandEnabled(i, true); + } } void Browser::SetStarredButtonToggled(bool starred) { diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index 6540c2e..9e8de5e 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -5,6 +5,9 @@ #ifndef CHROME_BROWSER_BROWSER_H_ #define CHROME_BROWSER_BROWSER_H_ +#include <vector> + +#include "chrome/browser/browser_process.h" #include "chrome/browser/controller.h" #include "chrome/browser/shell_dialogs.h" #include "chrome/browser/browser_window.h" @@ -76,11 +79,20 @@ class Browser : public TabStripModelDelegate, Type type() const { return type_; } Profile* profile() const { return profile_; } + const std::vector<std::wstring>& user_data_dir_profiles() const { + return g_browser_process->user_data_dir_profiles(); + } BrowserWindow* window() const { return window_; } ToolbarModel* toolbar_model() { return &toolbar_model_; } const SessionID& session_id() const { return session_id_; } CommandController* controller() { return &controller_; } + // Setters ///////////////////////////////////////////////////////////////// + + void set_user_data_dir_profiles(const std::vector<std::wstring>& profiles) { + g_browser_process->user_data_dir_profiles() = profiles; + } + // Browser Creation Helpers ///////////////////////////////////////////////// // Opens a new window with the default blank tab. @@ -217,6 +229,10 @@ class Browser : public TabStripModelDelegate, void CloseTab(); void CloseApp(); void NewWindow(); + // Commands to create a new window in a specific profile. + void NewProfileWindowByName(const std::wstring& profile); + // The index starts with 0, and specifies the index in the profiles vector. + void NewProfileWindowByIndex(int index); void NewIncognitoWindow(); void CloseWindow(); void SelectNextTab(); @@ -276,6 +292,8 @@ class Browser : public TabStripModelDelegate, void ShowDownloadsTab(); void OpenBookmarksManager(); void ToggleBookmarksBar(); + void OpenSelectProfileDialog(); + void OpenNewProfileDialog(); ///////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 9cb07f5..31cb529 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -678,6 +678,14 @@ > </File> <File + RelativePath=".\user_data_manager.cc" + > + </File> + <File + RelativePath=".\user_data_manager.h" + > + </File> + <File RelativePath=".\user_metrics.cc" > </File> diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index ff87093..66c5f7f 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -39,6 +39,7 @@ #include "chrome/browser/rlz/rlz.h" #include "chrome/browser/shell_integration.h" #include "chrome/browser/url_fixer_upper.h" +#include "chrome/browser/user_data_manager.h" #include "chrome/browser/user_metrics.h" #include "chrome/browser/views/user_data_dir_dialog.h" #include "chrome/common/chrome_constants.h" @@ -323,6 +324,10 @@ int BrowserMain(CommandLine &parsed_command_line, // BrowserProcessImpl's constructor should set g_browser_process. DCHECK(g_browser_process); + std::wstring local_state_path; + PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); + bool local_state_file_exists = file_util::PathExists(local_state_path); + // Load local state. This includes the application locale so we know which // locale dll to load. PrefService* local_state = browser_process->local_state(); @@ -359,6 +364,27 @@ int BrowserMain(CommandLine &parsed_command_line, first_run_ui_bypass = true; } + // If the local state file for the current profile doesn't exist and the + // parent profile command line flag is present, then we should inherit some + // local state from the parent profile. + // Checking that the local state file for the current profile doesn't exist + // is the most robust way to determine whether we need to inherit or not + // since the parent profile command line flag can be present even when the + // current profile is not a new one, and in that case we do not want to + // inherit and reset the user's setting. + if (!local_state_file_exists && + parsed_command_line.HasSwitch(switches::kParentProfile)) { + std::wstring parent_profile = + parsed_command_line.GetSwitchValue(switches::kParentProfile); + PrefService parent_local_state(parent_profile); + parent_local_state.RegisterStringPref(prefs::kApplicationLocale, + std::wstring()); + // Right now, we only inherit the locale setting from the parent profile. + local_state->SetString( + prefs::kApplicationLocale, + parent_local_state.GetString(prefs::kApplicationLocale)); + } + ResourceBundle::InitSharedInstance( local_state->GetString(prefs::kApplicationLocale)); // We only load the theme dll in the browser process. @@ -378,6 +404,9 @@ int BrowserMain(CommandLine &parsed_command_line, tracking_objects = tracked_objects::ThreadData::StartTracking(true); #endif + // Initialize the shared instance of user data manager. + UserDataManager::Create(); + // Try to create/load the profile. ProfileManager* profile_manager = browser_process->profile_manager(); Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index 75e20e4..69005ed 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -11,6 +11,7 @@ #define CHROME_BROWSER_BROWSER_PROCESS_H__ #include <string> +#include <vector> #include "base/basictypes.h" #include "base/message_loop.h" @@ -134,7 +135,15 @@ class BrowserProcess { virtual HANDLE shutdown_event() = 0; #endif + // Returns a reference to the user-data-dir based profiles vector. + std::vector<std::wstring>& user_data_dir_profiles() { + return user_data_dir_profiles_; + } + private: + // User-data-dir based profiles. + std::vector<std::wstring> user_data_dir_profiles_; + DISALLOW_EVIL_CONSTRUCTORS(BrowserProcess); }; diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 5a87b2d..cb1fe1b 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -16,6 +16,7 @@ #include "chrome/browser/profile.h" #include "chrome/browser/render_view_host.h" #include "chrome/browser/template_url.h" +#include "chrome/browser/user_data_manager.h" #include "chrome/browser/user_metrics.h" #include "chrome/browser/views/keyword_editor_view.h" #include "chrome/common/jstemplate_builder.h" @@ -168,11 +169,27 @@ void NewTabHTMLSource::StartDataRequest(const std::string& path, NOTREACHED(); return; } + + // Show the profile name in the title and most visited labels if the current + // profile is not the default. + std::wstring title; + std::wstring most_visited; + if (UserDataManager::Get()->is_current_profile_default()) { + title = l10n_util::GetString(IDS_NEW_TAB_TITLE); + most_visited = l10n_util::GetString(IDS_NEW_TAB_MOST_VISITED); + } else { + // Get the current profile name. + std::wstring profile_name = + UserDataManager::Get()->current_profile_name(); + title = l10n_util::GetStringF(IDS_NEW_TAB_TITLE_WITH_PROFILE_NAME, + profile_name); + most_visited = l10n_util::GetStringF( + IDS_NEW_TAB_MOST_VISITED_WITH_PROFILE_NAME, + profile_name); + } DictionaryValue localized_strings; - localized_strings.SetString(L"title", - l10n_util::GetString(IDS_NEW_TAB_TITLE)); - localized_strings.SetString(L"mostvisited", - l10n_util::GetString(IDS_NEW_TAB_MOST_VISITED)); + localized_strings.SetString(L"title", title); + localized_strings.SetString(L"mostvisited", most_visited); localized_strings.SetString(L"searches", l10n_util::GetString(IDS_NEW_TAB_SEARCHES)); localized_strings.SetString(L"bookmarks", @@ -841,7 +858,17 @@ NewTabUIContents::NewTabUIContents(Profile* profile, incognito_(false), most_visited_handler_(NULL) { set_type(TAB_CONTENTS_NEW_TAB_UI); - set_forced_title(l10n_util::GetString(IDS_NEW_TAB_TITLE)); + + // Show profile name in the title if the current profile is not the default. + std::wstring title; + if (UserDataManager::Get()->is_current_profile_default()) { + title = l10n_util::GetString(IDS_NEW_TAB_TITLE); + } else { + title = l10n_util::GetStringF( + IDS_NEW_TAB_TITLE_WITH_PROFILE_NAME, + UserDataManager::Get()->current_profile_name()); + } + set_forced_title(title); if (profile->IsOffTheRecord()) incognito_ = true; diff --git a/chrome/browser/user_data_manager.cc b/chrome/browser/user_data_manager.cc new file mode 100644 index 0000000..33bdf00 --- /dev/null +++ b/chrome/browser/user_data_manager.cc @@ -0,0 +1,307 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/user_data_manager.h" + +#include <windows.h> +#include <string> + +#include "base/command_line.h" +#include "base/file_util.h" +#include "base/logging.h" +#include "base/message_loop.h" +#include "base/path_service.h" +#include "base/process_util.h" +#include "base/string_util.h" +#include "chrome/browser/chrome_thread.h" +#include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/common/l10n_util.h" +#include "chrome/installer/util/browser_distribution.h" +#include "chrome/installer/util/shell_util.h" + +#include "chromium_strings.h" + +namespace { + +// Helper to start chrome for a given profile index. The helper takes care of +// enumerating profiles on the file thread and then it launches Chrome for the +// appropriate profile on the original thread. +// An instance of this class should always be created on the heap, and it will +// delete itself when the launch is done. +class LaunchChromeForProfileIndexHelper : GetProfilesHelper::Delegate { + public: + // Creates an instance with the given data manager and to launch chrome for + // the profile with the given index. + LaunchChromeForProfileIndexHelper(const UserDataManager* manager, int index); + virtual ~LaunchChromeForProfileIndexHelper(); + + // Starts the asynchronous launch. + void StartLaunch(); + + // GetProfilesHelper::Delegate method. + void OnGetProfilesDone(const std::vector<std::wstring>& profiles); + + private: + int index_; + const UserDataManager* manager_; + scoped_refptr<GetProfilesHelper> profiles_helper_; + + DISALLOW_COPY_AND_ASSIGN(LaunchChromeForProfileIndexHelper); +}; + +} // namespace + +LaunchChromeForProfileIndexHelper::LaunchChromeForProfileIndexHelper( + const UserDataManager* manager, + int index) + : manager_(manager), + index_(index), +// Don't complain about using "this" in initializer list. +MSVC_PUSH_DISABLE_WARNING(4355) + profiles_helper_(new GetProfilesHelper(this)) { +MSVC_POP_WARNING() + DCHECK(manager); +} + +LaunchChromeForProfileIndexHelper::~LaunchChromeForProfileIndexHelper() { + profiles_helper_->OnDelegateDeleted(); +} + +void LaunchChromeForProfileIndexHelper::StartLaunch() { + profiles_helper_->GetProfiles(NULL); +} + +void LaunchChromeForProfileIndexHelper::OnGetProfilesDone( + const std::vector<std::wstring>& profiles) { + if (index_ >= 0 && index_ < static_cast<int>(profiles.size())) + manager_->LaunchChromeForProfile(profiles[index_]); + + // We are done, delete ourselves. + delete this; +} + +// Separator used in folder names between the prefix and the profile name. +// For e.g. a folder for the profile "Joe" would be named "User Data-Joe". +static const wchar_t kProfileFolderSeparator[] = L"-"; + +// static +UserDataManager* UserDataManager::instance_ = NULL; + +// static +void UserDataManager::Create() { + DCHECK(!instance_); + std::wstring user_data; + PathService::Get(chrome::DIR_USER_DATA, &user_data); + instance_ = new UserDataManager(user_data); +} + +// static +UserDataManager* UserDataManager::Get() { + DCHECK(instance_); + return instance_; +} + +UserDataManager::UserDataManager(const std::wstring& user_data_root) + : user_data_root_(user_data_root) { + // Determine current profile name and current folder name. + current_folder_name_ = file_util::GetFilenameFromPath(user_data_root); + bool success = GetProfileNameFromFolderName(current_folder_name_, + ¤t_profile_name_); + // The current profile is a default profile if the current user data folder + // name is just kUserDataDirname or when the folder name doesn't have the + // kUserDataDirname as prefix. + is_current_profile_default_ = + !success || (current_folder_name_ == chrome::kUserDataDirname); + + // (TODO:munjal) Fix issue 5070: + // http://code.google.com/p/chromium/issues/detail?id=5070 + + file_util::UpOneDirectory(&user_data_root_); +} + +UserDataManager::~UserDataManager() { +} + +// static +bool UserDataManager::GetProfileNameFromFolderName( + const std::wstring& folder_name, + std::wstring* profile_name) { + // The folder name should start with a specific prefix for it to be a valid + // profile folder. + if (folder_name.find(chrome::kUserDataDirname) != 0) + return false; + + // Seems like we cannot use arraysize macro for externally defined constants. + // Is there a way? + unsigned int prefix_length = wcslen(chrome::kUserDataDirname); + // Subtract 1 from the size of the array for trailing null character. + unsigned int separator_length = arraysize(kProfileFolderSeparator) - 1; + + // It's safe to use profile_name variable for intermediate values since we + // will always return true now. + *profile_name = folder_name.substr(prefix_length); + // Remove leading separator if present. + if (profile_name->find_first_of(kProfileFolderSeparator) == 0) + *profile_name = profile_name->substr(separator_length); + + if (profile_name->empty()) + *profile_name = chrome::kNotSignedInProfile; + + return true; +} + +// static +std::wstring UserDataManager::GetFolderNameFromProfileName( + const std::wstring& profile_name) { + std::wstring folder_name = chrome::kUserDataDirname; + if (profile_name != chrome::kNotSignedInProfile) { + folder_name += kProfileFolderSeparator; + folder_name += profile_name; + } + return folder_name; +} + +std::wstring UserDataManager::GetUserDataFolderForProfile( + const std::wstring& profile_name) const { + std::wstring folder_name = GetFolderNameFromProfileName(profile_name); + std::wstring folder_path(user_data_root_); + file_util::AppendToPath(&folder_path, folder_name); + return folder_path; +} + +std::wstring UserDataManager::GetCommandForProfile( + const std::wstring& profile_name) const { + std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name); + std::wstring command; + PathService::Get(base::FILE_EXE, &command); + CommandLine::AppendSwitchWithValue(&command, + switches::kUserDataDir, + user_data_dir); + std::wstring local_state_path; + PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); + CommandLine::AppendSwitchWithValue(&command, + switches::kParentProfile, + local_state_path); + return command; +} + +void UserDataManager::LaunchChromeForProfile( + const std::wstring& profile_name) const { + std::wstring command = GetCommandForProfile(profile_name); + base::LaunchApp(command, false, false, NULL); +} + +void UserDataManager::LaunchChromeForProfile(int index) const { + // Helper deletes itself when done. + LaunchChromeForProfileIndexHelper* helper = + new LaunchChromeForProfileIndexHelper(this, index); + helper->StartLaunch(); +} + +void UserDataManager::GetProfiles(std::vector<std::wstring>* profiles) const { + // This function should be called on the file thread. + DCHECK(MessageLoop::current() == + ChromeThread::GetMessageLoop(ChromeThread::FILE)); + file_util::FileEnumerator file_enum(user_data_root_, + false, + file_util::FileEnumerator::DIRECTORIES); + std::wstring folder_name; + while (!(folder_name = file_enum.Next()).empty()) { + folder_name = file_util::GetFilenameFromPath(folder_name); + std::wstring profile_name; + if (GetProfileNameFromFolderName(folder_name, &profile_name)) + profiles->push_back(profile_name); + } +} + +bool UserDataManager::CreateDesktopShortcutForProfile( + const std::wstring& profile_name) const { + std::wstring exe_path; + std::wstring shortcut_path; + if (!PathService::Get(base::FILE_EXE, &exe_path) || + !ShellUtil::GetDesktopPath(false, &shortcut_path)) + return false; + + // Working directory. + std::wstring exe_folder = file_util::GetDirectoryFromPath(exe_path); + + // Command and arguments. + std::wstring cmd; + cmd = StringPrintf(L"\"%ls\"", exe_path.c_str()); + std::wstring user_data_dir = GetUserDataFolderForProfile(profile_name); + std::wstring args = CommandLine::PrefixedSwitchStringWithValue( + switches::kUserDataDir, + user_data_dir); + args = StringPrintf(L"\"%ls\"", args.c_str()); + + // Shortcut path. + std::wstring shortcut_name = l10n_util::GetStringF( + IDS_START_IN_PROFILE_SHORTCUT_NAME, + profile_name); + shortcut_name.append(L".lnk"); + file_util::AppendToPath(&shortcut_path, shortcut_name); + + return file_util::CreateShortcutLink(cmd.c_str(), + shortcut_path.c_str(), + exe_folder.c_str(), + args.c_str(), + NULL, + exe_path.c_str(), + 0); +} + +GetProfilesHelper::GetProfilesHelper(Delegate* delegate) + : delegate_(delegate) { +} + +void GetProfilesHelper::GetProfiles(MessageLoop* target_loop) { + // If the target loop is not NULL then use the target loop, or if it's NULL + // then use the current message loop to post a task on it later when we are + // done building a list of profiles. + if (target_loop) { + message_loop_ = target_loop; + } else { + message_loop_ = MessageLoop::current(); + } + DCHECK(message_loop_); + MessageLoop* file_loop = ChromeThread::GetMessageLoop(ChromeThread::FILE); + file_loop->PostTask( + FROM_HERE, + NewRunnableMethod(this, &GetProfilesHelper::GetProfilesFromManager)); +} + +// Records that the delegate is closed. +void GetProfilesHelper::OnDelegateDeleted() { + delegate_ = NULL; +} + +void GetProfilesHelper::GetProfilesFromManager() { + // This function should be called on the file thread. + DCHECK(MessageLoop::current() == + ChromeThread::GetMessageLoop(ChromeThread::FILE)); + + // If the delegate is gone by now, no need to do any work. + if (!delegate_) + return; + + scoped_ptr< std::vector<std::wstring> > profiles( + new std::vector<std::wstring>); + UserDataManager::Get()->GetProfiles(profiles.get()); + + // Post a task on the original thread to call the delegate. + message_loop_->PostTask( + FROM_HERE, + NewRunnableMethod(this, + &GetProfilesHelper::InvokeDelegate, + profiles.release())); +} + +void GetProfilesHelper::InvokeDelegate(std::vector<std::wstring>* profiles) { + scoped_ptr< std::vector<std::wstring> > udd_profiles(profiles); + // If the delegate is gone by now, no need to do any work. + if (delegate_) + delegate_->OnGetProfilesDone(*udd_profiles.get()); +} diff --git a/chrome/browser/user_data_manager.h b/chrome/browser/user_data_manager.h new file mode 100644 index 0000000..f5e4522 --- /dev/null +++ b/chrome/browser/user_data_manager.h @@ -0,0 +1,149 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This class encapsulates the implementation of multiple profiles by using +// the user-data-dir functionality. + +#ifndef CHROME_BROWSER_USER_DATA_MANAGER_H_ +#define CHROME_BROWSER_USER_DATA_MANAGER_H_ + +#include <string> +#include <vector> + +#include "base/basictypes.h" +#include "base/ref_counted.h" + +class MessageLoop; + +// Provides an abstraction of profiles on top of the user data directory +// feature. Given the root of the user data directories, it provides +// functionality to enumerate the existing profiles and start Chrome in a +// given profile. +// Also holds a shared instance of its own for convenience though it's not a +// singleton class. The shared instance should be created by the main thread, +// then other threads can access and use the shared instance. +class UserDataManager { + public: + // Creates the shared instance of this class. This method is not thread-safe, + // so the shared instance should be created on the main thread. + static void Create(); + + // Returns the shared instance. CreateInstance must be called before callling + // this method. + static UserDataManager* Get(); + + // Creates a new instance with the given root folder for storing user data + // folders. + explicit UserDataManager(const std::wstring& user_data_root); + + ~UserDataManager(); + + // Returns the name of the current profile. + std::wstring current_profile_name() const { return current_profile_name_; } + + // Returns whether the current profile is the default profile or not. + bool is_current_profile_default() const { + return is_current_profile_default_; + } + + // Populates the given vector with a list of all the profiles. + // This function should be called on the file thread. + void GetProfiles(std::vector<std::wstring>* profiles) const; + + // Creates a desktop shortcut for the given profile name. + // Returns false if the shortcut creation fails; true otherwise. + bool CreateDesktopShortcutForProfile(const std::wstring& profile_name) const; + + // Starts a new Chrome instance in the given profile name. + void LaunchChromeForProfile(const std::wstring& profile_name) const; + + // Starts a new Chrome instance in the profile with the given index. The + // index is zero based, and refers to the position of the profile in the + // list of profile names in alphabetical order. + // This method launches Chrome asynchornously since it enumerates profiles + // on a separate thread. + void LaunchChromeForProfile(int index) const; + + private: + // Gets the name of the profile from the name of the folder. + // Returns false if the folder does not correspond to a profile folder, true + // otherwise. + static bool GetProfileNameFromFolderName(const std::wstring& folder_name, + std::wstring* profile_name); + + // Returns the name of the folder from the name of the profile. + static std::wstring GetFolderNameFromProfileName( + const std::wstring& profile_name); + + // Returns the path of the user data folder for the given profile. + std::wstring GetUserDataFolderForProfile( + const std::wstring& profile_name) const; + + // Returns the command to start the app in the given profile. + std::wstring GetCommandForProfile(const std::wstring& profile_name) const; + + // Shared instance. + static UserDataManager* instance_; + + // Root folder. + std::wstring user_data_root_; + + // Current user data folder. + std::wstring current_folder_name_; + + // Whether the current profile is the default profile. + bool is_current_profile_default_; + + // Current profile name. + std::wstring current_profile_name_; + + DISALLOW_COPY_AND_ASSIGN(UserDataManager); +}; + +// Helper class to enumerate the profiles asynchronously on the file thread. +// It calls the given delegate instance when the enumeration is complete. +// USAGE: Create an instance of the helper with a delegate instance, call the +// asynchronous method GetProfiles. The delegate instance will be called when +// enumerating profiles is done. +// IMPORTANT: It's the responsibility of the caller to call OnDelegateDeleted +// method when the delegate instance is deleted. Typically OnDelegateDeleted +// should be called in the destructor of the delegate. This is the way to +// tell the helper to not call the delegate when enumerating profiles is done. +class GetProfilesHelper + : public base::RefCountedThreadSafe<GetProfilesHelper> { + public: + // Interface the delegate classes should implement. + class Delegate { + public: + virtual void OnGetProfilesDone( + const std::vector<std::wstring>& profiles) = 0; + virtual ~Delegate() { } + }; + + explicit GetProfilesHelper(Delegate* delegate); + + // Asynchronous call to get the list of profiles. Calls the delegate when done + // on either the given target loop or the message loop on which this function + // is called if target loop is NULL. + void GetProfiles(MessageLoop* target_loop); + + // Records that the delegate is deleted. + void OnDelegateDeleted(); + + private: + // Helper to get the profiles from user data manager. + void GetProfilesFromManager(); + + // Helper to invoke the delegate. + void InvokeDelegate(std::vector<std::wstring>* profiles); + + // Delegate to call. + Delegate* delegate_; + // Message loop to post tasks on completion of loading profiles. + MessageLoop* message_loop_; + + DISALLOW_COPY_AND_ASSIGN(GetProfilesHelper); +}; + +#endif // CHROME_BROWSER_USER_DATA_MANAGER_H_ diff --git a/chrome/browser/views/browser_views.vcproj b/chrome/browser/views/browser_views.vcproj index 6eed9d0..b605de5 100644 --- a/chrome/browser/views/browser_views.vcproj +++ b/chrome/browser/views/browser_views.vcproj @@ -650,6 +650,14 @@ > </File> <File + RelativePath=".\new_profile_dialog.cc" + > + </File> + <File + RelativePath=".\new_profile_dialog.h" + > + </File> + <File RelativePath=".\page_info_window.cc" > </File> @@ -706,6 +714,14 @@ > </File> <File + RelativePath=".\select_profile_dialog.cc" + > + </File> + <File + RelativePath=".\select_profile_dialog.h" + > + </File> + <File RelativePath=".\shelf_item_dialog.cc" > </File> diff --git a/chrome/browser/views/new_profile_dialog.cc b/chrome/browser/views/new_profile_dialog.cc new file mode 100644 index 0000000..07c3c708 --- /dev/null +++ b/chrome/browser/views/new_profile_dialog.cc @@ -0,0 +1,105 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/views/new_profile_dialog.h" + +#include <string> + +#include "base/logging.h" +#include "base/file_util.h" +#include "chrome/app/locales/locale_settings.h" +#include "chrome/browser/user_data_manager.h" +#include "chrome/common/l10n_util.h" +#include "chrome/views/message_box_view.h" +#include "chrome/views/text_field.h" +#include "chrome/views/view.h" +#include "chrome/views/window.h" + +#include "chromium_strings.h" +#include "generated_resources.h" + +// static +void NewProfileDialog::RunDialog() { + NewProfileDialog* dlg = new NewProfileDialog(); + views::Window::CreateChromeWindow(NULL, gfx::Rect(), dlg)->Show(); +} + +NewProfileDialog::NewProfileDialog() { + std::wstring message_text = l10n_util::GetString( + IDS_NEW_PROFILE_DIALOG_LABEL_TEXT); + const int kDialogWidth = views::Window::GetLocalizedContentsWidth( + IDS_NEW_PROFILE_DIALOG_WIDTH_CHARS); + const int kMessageBoxFlags = MessageBoxView::kFlagHasOKButton | + MessageBoxView::kFlagHasCancelButton | + MessageBoxView::kFlagHasPromptField; + message_box_view_ = new MessageBoxView(kMessageBoxFlags, + message_text.c_str(), + std::wstring(), + kDialogWidth); + message_box_view_->SetCheckBoxLabel( + l10n_util::GetString(IDS_NEW_PROFILE_DIALOG_CREATE_SHORTCUT_TEXT)); + message_box_view_->SetCheckBoxSelected(true); + message_box_view_->text_box()->SetController(this); +} + +NewProfileDialog::~NewProfileDialog() { +} + +int NewProfileDialog::GetDialogButtons() const { + return DIALOGBUTTON_OK | DIALOGBUTTON_CANCEL; +} + +views::View* NewProfileDialog::GetInitiallyFocusedView() const { + views::TextField* text_box = message_box_view_->text_box(); + DCHECK(text_box); + return text_box; +} + +bool NewProfileDialog::IsDialogButtonEnabled( + DialogButton button) const { + if (button == DIALOGBUTTON_OK) { + std::wstring profile_name = message_box_view_->GetInputText(); + // TODO(munjal): Refactor the function ReplaceIllegalCharacters in + // file_util to something that just checks if there are illegal chars + // since that's what we really need. Also, replaceIllegalChars seems to + // be expensive since it builds a list of illegal characters for each call. + // So at the least fix that. + file_util::ReplaceIllegalCharacters(&profile_name, L'_'); + return !profile_name.empty() && + profile_name == message_box_view_->GetInputText(); + } + return true; +} + +std::wstring NewProfileDialog::GetWindowTitle() const { + return l10n_util::GetString(IDS_NEW_PROFILE_DIALOG_TITLE); +} + +void NewProfileDialog::WindowClosing() { + delete this; +} + +void NewProfileDialog::ContentsChanged(views::TextField* sender, + const std::wstring& new_contents) { + GetDialogClientView()->UpdateDialogButtons(); +} + +bool NewProfileDialog::Accept() { + std::wstring profile_name = message_box_view_->GetInputText(); + if (profile_name.empty()) { + NOTREACHED(); + return true; + } + // Create a desktop shortcut if the corresponding checkbox is checked. + if (message_box_view_->IsCheckBoxSelected()) + UserDataManager::Get()->CreateDesktopShortcutForProfile( + profile_name); + + UserDataManager::Get()->LaunchChromeForProfile(profile_name); + return true; +} + +views::View* NewProfileDialog::GetContentsView() { + return message_box_view_; +} diff --git a/chrome/browser/views/new_profile_dialog.h b/chrome/browser/views/new_profile_dialog.h new file mode 100644 index 0000000..970a820 --- /dev/null +++ b/chrome/browser/views/new_profile_dialog.h @@ -0,0 +1,59 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// A dialog box that prompts the user to enter a profile name, and opens a new +// window in that profile. + +#ifndef CHROME_BROWSER_VIEWS_NEW_PROFILE_DIALOG_H_ +#define CHROME_BROWSER_VIEWS_NEW_PROFILE_DIALOG_H_ + +#include "base/basictypes.h" +#include "base/message_loop.h" +#include "chrome/browser/shell_dialogs.h" +#include "chrome/views/dialog_delegate.h" +#include "chrome/views/text_field.h" + +class MessageBoxView; +namespace views { +class View; +class Window; +} + +// Dialog that prompts the user to create a new profile. +class NewProfileDialog : public views::DialogDelegate, + public views::TextField::Controller { + public: + // Creates and runs the dialog. + static void RunDialog(); + virtual ~NewProfileDialog(); + + // views::DialogDelegate methods. + virtual bool Accept(); + virtual int GetDialogButtons() const; + virtual views::View* GetInitiallyFocusedView() const; + virtual bool IsDialogButtonEnabled(DialogButton button) const; + virtual std::wstring GetWindowTitle() const; + virtual void WindowClosing(); + + // views::TextField::Controller methods. + virtual void ContentsChanged(views::TextField* sender, + const std::wstring& new_contents); + virtual void HandleKeystroke(views::TextField* sender, + UINT message, TCHAR key, UINT repeat_count, + UINT flags) {} + + // views::WindowDelegate methods. + virtual views::View* GetContentsView(); + virtual bool IsAlwaysOnTop() const { return false; } + virtual bool IsModal() const { return false; } + + private: + NewProfileDialog(); + + MessageBoxView* message_box_view_; + + DISALLOW_COPY_AND_ASSIGN(NewProfileDialog); +}; + +#endif // CHROME_BROWSER_VIEWS_NEW_PROFILE_DIALOG_H_ diff --git a/chrome/browser/views/select_profile_dialog.cc b/chrome/browser/views/select_profile_dialog.cc new file mode 100644 index 0000000..50353ba --- /dev/null +++ b/chrome/browser/views/select_profile_dialog.cc @@ -0,0 +1,153 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/views/select_profile_dialog.h" + +#include <string> + +#include "base/logging.h" +#include "base/string_util.h" +#include "chrome/app/locales/locale_settings.h" +#include "chrome/browser/user_data_manager.h" +#include "chrome/browser/views/new_profile_dialog.h" +#include "chrome/browser/views/standard_layout.h" +#include "chrome/common/l10n_util.h" +#include "chrome/views/combo_box.h" +#include "chrome/views/grid_layout.h" +#include "chrome/views/label.h" +#include "chrome/views/message_box_view.h" +#include "chrome/views/view.h" +#include "chrome/views/window.h" + +#include "chromium_strings.h" +#include "generated_resources.h" + +using views::ColumnSet; +using views::GridLayout; + +// static +void SelectProfileDialog::RunDialog() { + // When the window closes, it will delete itself. + SelectProfileDialog* dlg = new SelectProfileDialog(); + views::Window::CreateChromeWindow(NULL, gfx::Rect(), dlg)->Show(); +} + +SelectProfileDialog::SelectProfileDialog() + : helper_(new GetProfilesHelper(this)) { + // We first create an instance of the helper and then setup controls. This + // doesn't lead to race condition because once the helper is done with + // enumerating profiles by examining the file system, it posts a task on the + // thread it was called on. This is the same thread that the current code is + // running on. So that task wouldn't get executed until we are done with + // setup controls. Given that, we start the helper before setup controls so + // that file enumeration can be done as soon as possible. + helper_->GetProfiles(NULL); + SetupControls(); +} + +SelectProfileDialog::~SelectProfileDialog() { + helper_->OnDelegateDeleted(); +} + +gfx::Size SelectProfileDialog::GetPreferredSize() { + return gfx::Size(views::Window::GetLocalizedContentsSize( + IDS_SELECT_PROFILE_DIALOG_WIDTH_CHARS, + IDS_SELECT_PROFILE_DIALOG_HEIGHT_LINES)); +} + +void SelectProfileDialog::PopulateProfilesComboBox( + const std::vector<std::wstring>& profiles) { + profiles_.insert(profiles_.begin(), profiles.begin(), profiles.end()); + profile_combobox_->ModelChanged(); + GetDialogClientView()->UpdateDialogButtons(); +} + +void SelectProfileDialog::Layout() { + GetLayoutManager()->Layout(this); +} + +int SelectProfileDialog::GetDialogButtons() const { + return DIALOGBUTTON_OK | DIALOGBUTTON_CANCEL; +} + +views::View* SelectProfileDialog::GetInitiallyFocusedView() const { + return profile_combobox_; +} + +std::wstring SelectProfileDialog::GetWindowTitle() const { + return l10n_util::GetString(IDS_SELECT_PROFILE_DIALOG_TITLE); +} + +bool SelectProfileDialog::Accept() { + int index = profile_combobox_->GetSelectedItem(); + if (index < 0) { + NOTREACHED(); + return true; + } + + // If the user has selected <New Profile> from the drop down, then show the + // new profile dialog to the user. + if (index == profiles_.size()) { + NewProfileDialog::RunDialog(); + return true; + } + + std::wstring profile_name = profiles_[index]; + UserDataManager::Get()->LaunchChromeForProfile(profile_name); + return true; +} + +bool SelectProfileDialog::Cancel() { + return true; +} + +views::View* SelectProfileDialog::GetContentsView() { + return this; +} + +int SelectProfileDialog::GetItemCount(views::ComboBox* source) { + // Always show one more item in the combo box that allows the user to select + // <New Profile>. + return profiles_.size() + 1; +} + +std::wstring SelectProfileDialog::GetItemAt(views::ComboBox* source, + int index) { + DCHECK(source == profile_combobox_); + DCHECK(index >= 0 && index <= static_cast<int>(profiles_.size())); + // For the last item in the drop down, return the <New Profile> text, + // otherwise return the corresponding profile name from the vector. + return index == profiles_.size() ? + l10n_util::GetString(IDS_SELECT_PROFILE_DIALOG_NEW_PROFILE_ENTRY) : + profiles_[index]; +} + +void SelectProfileDialog::OnGetProfilesDone( + const std::vector<std::wstring>& profiles) { + PopulateProfilesComboBox(profiles); +} + +void SelectProfileDialog::SetupControls() { + // Adds all controls. + select_profile_label_ = new views::Label( + l10n_util::GetString(IDS_SELECT_PROFILE_DIALOG_LABEL_TEXT)); + profile_combobox_ = new views::ComboBox(this); + + // Arranges controls by using GridLayout. + const int column_set_id = 0; + GridLayout* layout = CreatePanelGridLayout(this); + SetLayoutManager(layout); + ColumnSet* column_set = layout->AddColumnSet(column_set_id); + column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0, + GridLayout::USE_PREF, 0, 0); + column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing); + column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 0, + GridLayout::FIXED, 200, 0); + + layout->StartRow(0, column_set_id); + layout->AddView(select_profile_label_); + layout->AddPaddingRow(0, kRelatedControlVerticalSpacing); + layout->StartRow(0, column_set_id); + layout->AddView(profile_combobox_); +} diff --git a/chrome/browser/views/select_profile_dialog.h b/chrome/browser/views/select_profile_dialog.h new file mode 100644 index 0000000..f42df85 --- /dev/null +++ b/chrome/browser/views/select_profile_dialog.h @@ -0,0 +1,84 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// A dialog box that shows the user various profiles that currently exist +// and lets the user select one. + +#ifndef CHROME_BROWSER_VIEWS_SELECT_PROFILE_DIALOG_H_ +#define CHROME_BROWSER_VIEWS_SELECT_PROFILE_DIALOG_H_ + +#include <vector> + +#include "base/basictypes.h" +#include "base/message_loop.h" +#include "base/ref_counted.h" +#include "chrome/browser/shell_dialogs.h" +#include "chrome/browser/user_data_manager.h" +#include "chrome/views/combo_box.h" +#include "chrome/views/dialog_delegate.h" + +class SelectProfileDialogHelper; +namespace views { +class Label; +class Window; +} + +// Dialog to allow the user to select a profile to open a new window. +class SelectProfileDialog + : public views::DialogDelegate, + public views::View, + public views::ComboBox::Model, + public GetProfilesHelper::Delegate { + public: + // Creates and runs the dialog. + static void RunDialog(); + + virtual ~SelectProfileDialog(); + + // Populates the list of profiles from the given vector. + void PopulateProfilesComboBox(const std::vector<std::wstring>& profiles); + + // Returns the profile name selected by the user. + std::wstring profile_name() { return profile_name_; } + + // views::View methods. + virtual gfx::Size GetPreferredSize(); + virtual void Layout(); + + // views::DialogDelegate Methods: + virtual bool Accept(); + virtual bool Cancel(); + virtual views::View* GetContentsView(); + virtual int GetDialogButtons() const; + virtual views::View* GetInitiallyFocusedView() const; + virtual std::wstring GetWindowTitle() const; + virtual bool IsModal() const { return false; } + + // views::ComboBox::Model methods. + virtual int GetItemCount(views::ComboBox* source); + virtual std::wstring GetItemAt(views::ComboBox* source, int index); + + // GetProfilesHelper::Delegate method. + virtual void OnGetProfilesDone(const std::vector<std::wstring>& profiles); + + private: + SelectProfileDialog(); + + // Sets up all UI controls for the dialog. + void SetupControls(); + + // UI controls. + views::ComboBox* profile_combobox_; + views::Label* select_profile_label_; + + std::vector<std::wstring> profiles_; + std::wstring profile_name_; + + // Helper instance that handles all task posting activities. + scoped_refptr<GetProfilesHelper> helper_; + + DISALLOW_COPY_AND_ASSIGN(SelectProfileDialog); +}; + +#endif // CHROME_BROWSER_VIEWS_SELECT_PROFILE_DIALOG_H_ diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index ad3d8d0..246f1c7 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -19,6 +19,7 @@ #include "chrome/browser/navigation_controller.h" #include "chrome/browser/navigation_entry.h" #include "chrome/browser/profile.h" +#include "chrome/browser/user_data_manager.h" #include "chrome/browser/user_metrics.h" #include "chrome/browser/views/dom_view.h" #include "chrome/browser/views/go_button.h" @@ -74,7 +75,9 @@ BrowserToolbarView::BrowserToolbarView(CommandController* controller, profile_(NULL), acc_focused_view_(NULL), browser_(browser), - tab_(NULL) { + tab_(NULL), + profiles_helper_(new GetProfilesHelper(this)), + profiles_menu_(NULL) { back_menu_model_.reset(new BackForwardMenuModel( browser, BackForwardMenuModel::BACKWARD_MENU_DELEGATE)); forward_menu_model_.reset(new BackForwardMenuModel( @@ -87,6 +90,7 @@ BrowserToolbarView::BrowserToolbarView(CommandController* controller, } BrowserToolbarView::~BrowserToolbarView() { + profiles_helper_->OnDelegateDeleted(); } void BrowserToolbarView::Init(Profile* profile) { @@ -538,6 +542,16 @@ void BrowserToolbarView::RunAppMenu(const CPoint& pt, HWND hwnd) { l10n_util::GetString(IDS_NEWWINDOW)); menu.AppendMenuItemWithLabel(IDC_GOOFFTHERECORD, l10n_util::GetString(IDS_GOOFFTHERECORD)); + + // Enumerate profiles asynchronously and then create the parent menu item + // "Open new window in profile...". We will create the child menu items for + // this once the asynchronous call is done. See OnGetProfilesDone. + profiles_helper_->GetProfiles(NULL); + Menu* profiles_menu = menu.AppendSubMenu( + IDC_NEWPROFILEWINDOW, + l10n_util::GetString(IDS_NEWPROFILEWINDOW)); + profiles_menu_ = profiles_menu; + menu.AppendSeparator(); menu.AppendMenuItemWithLabel(IDC_SHOW_BOOKMARKS_BAR, l10n_util::GetString(IDS_SHOW_BOOKMARK_BAR)); @@ -565,6 +579,9 @@ void BrowserToolbarView::RunAppMenu(const CPoint& pt, HWND hwnd) { menu.AppendMenuItemWithLabel(IDC_EXIT, l10n_util::GetString(IDS_EXIT)); menu.RunMenuAt(pt.x, pt.y); + + // Menu is going away, so set the profiles menu pointer to NULL. + profiles_menu_ = NULL; } bool BrowserToolbarView::IsItemChecked(int id) const { @@ -590,6 +607,39 @@ void BrowserToolbarView::RunMenu(views::View* source, const CPoint& pt, } } +void BrowserToolbarView::OnGetProfilesDone( + const std::vector<std::wstring>& profiles) { + // Nothing to do if the menu has gone away. + if (!profiles_menu_) + return; + + // Store the latest list of profiles in the browser. + browser_->set_user_data_dir_profiles(profiles); + + // Number of sub menu items that we can show directly. + const int sub_items_count = IDC_NEWPROFILEWINDOW_MAX_ID - + IDC_NEWPROFILEWINDOW_MIN_ID + 1; + std::vector<std::wstring>::const_iterator iter = profiles.begin(); + // Add direct sub menu items for profiles. + for (int i = IDC_NEWPROFILEWINDOW_MIN_ID; + i <= IDC_NEWPROFILEWINDOW_MAX_ID && iter != profiles.end(); + ++i, ++iter) { + profiles_menu_->AppendMenuItemWithLabel(i, *iter); + } + // If there are more profiles then show "Other" link. + if (iter != profiles.end()) { + profiles_menu_->AppendSeparator(); + profiles_menu_->AppendMenuItemWithLabel( + IDC_SELECT_PROFILE, + l10n_util::GetString(IDS_NEWPROFILEWINDOW_OTHERPROFILE)); + } + // Always show a link to select a new profile. + profiles_menu_->AppendSeparator(); + profiles_menu_->AppendMenuItemWithLabel( + IDC_NEW_PROFILE, + l10n_util::GetString(IDS_SELECT_PROFILE_DIALOG_NEW_PROFILE_ENTRY)); +} + bool BrowserToolbarView::GetAccessibleRole(VARIANT* role) { DCHECK(role); @@ -698,6 +748,19 @@ void BrowserToolbarView::Observe(NotificationType type, } } +void BrowserToolbarView::ExecuteCommand(int id) { + // If the command id is for one of the sub-menu-items of the new profile + // window menu then we need to get the name of the profile from the menu + // item id and then pass on that to the browser to take action. + if (id >= IDC_NEWPROFILEWINDOW_MIN_ID && id <= IDC_NEWPROFILEWINDOW_MAX_ID) { + browser_->NewProfileWindowByIndex(id - IDC_NEWPROFILEWINDOW_MIN_ID); + return; + } + + // For all other menu items, use the method in the base class. + EncodingMenuControllerDelegate::ExecuteCommand(id); +} + bool BrowserToolbarView::GetAcceleratorInfo(int id, views::Accelerator* accel) { // The standard Ctrl-X, Ctrl-V and Ctrl-C are not defined as accelerators diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index 6358e7a..a8067e2 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -7,10 +7,12 @@ #include <vector> +#include "base/ref_counted.h" #include "base/scoped_ptr.h" #include "chrome/browser/back_forward_menu_model.h" #include "chrome/browser/controller.h" #include "chrome/browser/encoding_menu_controller_delegate.h" +#include "chrome/browser/user_data_manager.h" #include "chrome/browser/views/dom_view.h" #include "chrome/browser/views/go_button.h" #include "chrome/browser/views/location_bar_view.h" @@ -37,7 +39,8 @@ class BrowserToolbarView : public views::View, public views::ViewMenuDelegate, public views::DragController, public LocationBarView::Delegate, - public NotificationObserver { + public NotificationObserver, + public GetProfilesHelper::Delegate { public: BrowserToolbarView(CommandController* controller, Browser* browser); virtual ~BrowserToolbarView(); @@ -57,11 +60,15 @@ class BrowserToolbarView : public views::View, virtual bool IsItemChecked(int id) const; // Overridden from Menu::BaseControllerDelegate: + virtual void ExecuteCommand(int id); virtual bool GetAcceleratorInfo(int id, views::Accelerator* accel); // views::MenuDelegate virtual void RunMenu(views::View* source, const CPoint& pt, HWND hwnd); + // GetProfilesHelper::Delegate method. + virtual void OnGetProfilesDone(const std::vector<std::wstring>& profiles); + // Sets the profile which is active on the currently-active tab. void SetProfile(Profile* profile); Profile* profile() { return profile_; } @@ -180,6 +187,12 @@ class BrowserToolbarView : public views::View, // Current tab we're showing state for. TabContents* tab_; + // Profiles menu to populate with profile names. + Menu* profiles_menu_; + + // Helper class to enumerate profiles information on the file thread. + scoped_refptr<GetProfilesHelper> profiles_helper_; + // Controls whether or not a home button should be shown on the toolbar. BooleanPrefMember show_home_button_; @@ -188,4 +201,3 @@ class BrowserToolbarView : public views::View, }; #endif // CHROME_BROWSER_VIEWS_TOOLBAR_VIEW_H__ - diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 5a1ab4c..4d076f9 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -112,6 +112,9 @@ const wchar_t kTestSandbox[] = L"test-sandbox"; // for all of its state. const wchar_t kUserDataDir[] = L"user-data-dir"; +// Specifies the path to the user data folder for the parent profile. +const wchar_t kParentProfile[] = L"parent-profile"; + // Specifies that the associated value should be launched in "application" mode. const wchar_t kApp[] = L"app"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index ddf3f6b..7a75cb5 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -39,6 +39,7 @@ extern const wchar_t kSafePlugins[]; extern const wchar_t kTrustedPlugins[]; extern const wchar_t kTestSandbox[]; extern const wchar_t kUserDataDir[]; +extern const wchar_t kParentProfile[]; extern const wchar_t kApp[]; extern const wchar_t kAppUploadFile[]; extern const wchar_t kDomAutomationController[]; diff --git a/chrome/views/message_box_view.cc b/chrome/views/message_box_view.cc index fc0b23f..2129212 100644 --- a/chrome/views/message_box_view.cc +++ b/chrome/views/message_box_view.cc @@ -9,6 +9,7 @@ #include "chrome/browser/controller.h" #include "chrome/browser/views/standard_layout.h" #include "chrome/common/l10n_util.h" +#include "chrome/views/checkbox.h" #include "chrome/views/client_view.h" #include "generated_resources.h" @@ -71,6 +72,12 @@ void MessageBoxView::SetCheckBoxLabel(const std::wstring& label) { ResetLayoutManager(); } +void MessageBoxView::SetCheckBoxSelected(bool selected) { + if (!check_box_) + return; + check_box_->SetIsSelected(selected); +} + /////////////////////////////////////////////////////////////////////////////// // MessageBoxView, views::View overrides: diff --git a/chrome/views/message_box_view.h b/chrome/views/message_box_view.h index 6ca5932..a8f0dca 100644 --- a/chrome/views/message_box_view.h +++ b/chrome/views/message_box_view.h @@ -43,6 +43,9 @@ class MessageBoxView : public views::View { const std::wstring& message, const std::wstring& default_prompt); + // Returns the text box. + views::TextField* text_box() { return prompt_field_; } + // Returns user entered data in the prompt field. std::wstring GetInputText(); @@ -59,6 +62,9 @@ class MessageBoxView : public views::View { // start, the message box has no checkbox until this function is called. void SetCheckBoxLabel(const std::wstring& label); + // Sets the state of the check-box. + void SetCheckBoxSelected(bool selected); + protected: // Layout and Painting functions. virtual void ViewHierarchyChanged(bool is_add, diff --git a/chrome/views/window.cc b/chrome/views/window.cc index 051cd1f..df70094 100644 --- a/chrome/views/window.cc +++ b/chrome/views/window.cc @@ -201,20 +201,30 @@ void Window::ExecuteSystemMenuCommand(int command) { } // static -gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, - int row_resource_id) { +int Window::GetLocalizedContentsWidth(int col_resource_id) { + double chars = _wtof(l10n_util::GetString(col_resource_id).c_str()); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); ChromeFont font = rb.GetFont(ResourceBundle::BaseFont); + int width = font.GetExpectedTextWidth(static_cast<int>(chars)); + DCHECK(width > 0); + return width; +} - double chars = _wtof(l10n_util::GetString(col_resource_id).c_str()); +// static +int Window::GetLocalizedContentsHeight(int row_resource_id) { double lines = _wtof(l10n_util::GetString(row_resource_id).c_str()); - - int width = font.GetExpectedTextWidth(static_cast<int>(chars)); + ResourceBundle& rb = ResourceBundle::GetSharedInstance(); + ChromeFont font = rb.GetFont(ResourceBundle::BaseFont); int height = static_cast<int>(font.height() * lines); + DCHECK(height > 0); + return height; +} - DCHECK(width > 0 && height > 0); - - return gfx::Size(width, height); +// static +gfx::Size Window::GetLocalizedContentsSize(int col_resource_id, + int row_resource_id) { + return gfx::Size(GetLocalizedContentsWidth(col_resource_id), + GetLocalizedContentsHeight(row_resource_id)); } /////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/views/window.h b/chrome/views/window.h index 3a3ae7b..bdd3d6d 100644 --- a/chrome/views/window.h +++ b/chrome/views/window.h @@ -116,6 +116,8 @@ class Window : public WidgetWin { // resource identified by |col_resource_id|, the height in the same fashion. // TODO(beng): This should eventually live somewhere else, probably closer to // ClientView. + static int GetLocalizedContentsWidth(int col_resource_id); + static int GetLocalizedContentsHeight(int row_resource_id); static gfx::Size GetLocalizedContentsSize(int col_resource_id, int row_resource_id); |