Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model.cc

Issue 9489011: Elide long emails in the wrench and profile menus. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rev2 Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 30 matching lines...) Expand all
41 #include "content/public/browser/notification_types.h" 41 #include "content/public/browser/notification_types.h"
42 #include "content/public/browser/user_metrics.h" 42 #include "content/public/browser/user_metrics.h"
43 #include "content/public/browser/web_contents.h" 43 #include "content/public/browser/web_contents.h"
44 #include "grit/chromium_strings.h" 44 #include "grit/chromium_strings.h"
45 #include "grit/generated_resources.h" 45 #include "grit/generated_resources.h"
46 #include "grit/theme_resources.h" 46 #include "grit/theme_resources.h"
47 #include "third_party/skia/include/core/SkBitmap.h" 47 #include "third_party/skia/include/core/SkBitmap.h"
48 #include "ui/base/l10n/l10n_util.h" 48 #include "ui/base/l10n/l10n_util.h"
49 #include "ui/base/models/button_menu_item_model.h" 49 #include "ui/base/models/button_menu_item_model.h"
50 #include "ui/base/resource/resource_bundle.h" 50 #include "ui/base/resource/resource_bundle.h"
51 #include "ui/base/text/text_elider.h"
51 #include "ui/gfx/image/image.h" 52 #include "ui/gfx/image/image.h"
52 53
53 #if defined(TOOLKIT_USES_GTK) 54 #if defined(TOOLKIT_USES_GTK)
54 #include <gtk/gtk.h> 55 #include <gtk/gtk.h>
55 #include "chrome/browser/ui/gtk/gtk_util.h" 56 #include "chrome/browser/ui/gtk/gtk_util.h"
56 #endif 57 #endif
57 58
58 #if defined(OS_WIN) 59 #if defined(OS_WIN)
59 #include "chrome/browser/enumerate_modules_model_win.h" 60 #include "chrome/browser/enumerate_modules_model_win.h"
60 #endif 61 #endif
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 ProfileSyncService* service = 261 ProfileSyncService* service =
261 ProfileSyncServiceFactory::GetInstance()->GetForProfile( 262 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
262 browser_->GetProfile()->GetOriginalProfile()); 263 browser_->GetProfile()->GetOriginalProfile());
263 SyncGlobalError* error = service->sync_global_error(); 264 SyncGlobalError* error = service->sync_global_error();
264 if (error && error->HasCustomizedSyncMenuItem()) 265 if (error && error->HasCustomizedSyncMenuItem())
265 return error->MenuItemLabel(); 266 return error->MenuItemLabel();
266 if (service->HasSyncSetupCompleted()) { 267 if (service->HasSyncSetupCompleted()) {
267 std::string username = browser_->GetProfile()->GetPrefs()->GetString( 268 std::string username = browser_->GetProfile()->GetPrefs()->GetString(
268 prefs::kGoogleServicesUsername); 269 prefs::kGoogleServicesUsername);
269 if (!username.empty()) { 270 if (!username.empty()) {
271 string16 elided_username = ui::ElideEmail(
272 UTF8ToUTF16(username),
273 ui::kMaxProfileUsernameLength);
270 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL, 274 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_SYNCED_LABEL,
271 UTF8ToUTF16(username)); 275 elided_username);
272 } 276 }
273 } 277 }
274 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL, 278 return l10n_util::GetStringFUTF16(IDS_SYNC_MENU_PRE_SYNCED_LABEL,
275 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME)); 279 l10n_util::GetStringUTF16(IDS_SHORT_PRODUCT_NAME));
276 } 280 }
277 default: 281 default:
278 NOTREACHED(); 282 NOTREACHED();
279 return string16(); 283 return string16();
280 } 284 }
281 } 285 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 &enable_increment, &enable_decrement); 574 &enable_increment, &enable_decrement);
571 } 575 }
572 zoom_label_ = l10n_util::GetStringFUTF16( 576 zoom_label_ = l10n_util::GetStringFUTF16(
573 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent)); 577 IDS_ZOOM_PERCENT, base::IntToString16(zoom_percent));
574 } 578 }
575 579
576 string16 WrenchMenuModel::GetSyncMenuLabel() const { 580 string16 WrenchMenuModel::GetSyncMenuLabel() const {
577 return sync_ui_util::GetSyncMenuLabel(ProfileSyncServiceFactory:: 581 return sync_ui_util::GetSyncMenuLabel(ProfileSyncServiceFactory::
578 GetInstance()->GetForProfile(browser_->profile()->GetOriginalProfile())); 582 GetInstance()->GetForProfile(browser_->profile()->GetOriginalProfile()));
579 } 583 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698