summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
authormunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 23:52:03 +0000
committermunjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-03 23:52:03 +0000
commitf253006b157f9c917fba21a7312290aaa2e889e7 (patch)
tree377183f9511bed141b5fd7a706c3407a122540d9 /chrome/browser/dom_ui
parentdadacf06556b4f63a62ec3cea91d7fc5abccd67c (diff)
downloadchromium_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
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc37
1 files changed, 32 insertions, 5 deletions
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;