| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 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/views/toolbar_view.h" | 5 #include "chrome/browser/views/toolbar_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_drag_data.h" | 13 #include "chrome/browser/bookmarks/bookmark_drag_data.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 14 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "chrome/browser/browser.h" | 15 #include "chrome/browser/browser.h" |
| 15 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/character_encoding.h" | 17 #include "chrome/browser/character_encoding.h" |
| 17 #include "chrome/browser/drag_utils.h" | 18 #include "chrome/browser/drag_utils.h" |
| 18 #include "chrome/browser/metrics/user_metrics.h" | 19 #include "chrome/browser/metrics/user_metrics.h" |
| 19 #include "chrome/browser/profile.h" | 20 #include "chrome/browser/profile.h" |
| 20 #include "chrome/browser/tab_contents/navigation_controller.h" | 21 #include "chrome/browser/tab_contents/navigation_controller.h" |
| 21 #include "chrome/browser/tab_contents/navigation_entry.h" | 22 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 22 #include "chrome/browser/user_data_manager.h" | 23 #include "chrome/browser/user_data_manager.h" |
| 23 #include "chrome/browser/views/dom_view.h" | 24 #include "chrome/browser/views/dom_view.h" |
| 24 #include "chrome/browser/views/go_button.h" | 25 #include "chrome/browser/views/go_button.h" |
| 25 #include "chrome/browser/views/location_bar_view.h" | 26 #include "chrome/browser/views/location_bar_view.h" |
| 26 #include "chrome/browser/views/theme_helpers.h" | 27 #include "chrome/browser/views/theme_helpers.h" |
| 27 #include "chrome/browser/views/toolbar_star_toggle.h" | 28 #include "chrome/browser/views/toolbar_star_toggle.h" |
| 28 #include "chrome/browser/view_ids.h" | 29 #include "chrome/browser/view_ids.h" |
| 29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 31 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/drag_drop_types.h" | 32 #include "chrome/common/drag_drop_types.h" |
| 31 #include "chrome/common/l10n_util.h" | 33 #include "chrome/common/l10n_util.h" |
| 32 #include "chrome/common/notification_service.h" | 34 #include "chrome/common/notification_service.h" |
| 33 #include "chrome/common/os_exchange_data.h" | 35 #include "chrome/common/os_exchange_data.h" |
| 34 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 35 #include "chrome/common/pref_service.h" | 37 #include "chrome/common/pref_service.h" |
| 36 #include "chrome/common/resource_bundle.h" | 38 #include "chrome/common/resource_bundle.h" |
| 37 #include "chrome/common/win_util.h" | 39 #include "chrome/common/win_util.h" |
| 38 #ifdef CHROME_PERSONALIZATION | 40 #ifdef CHROME_PERSONALIZATION |
| 39 #include "chrome/personalization/personalization.h" | 41 #include "chrome/personalization/personalization.h" |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 Menu menu(this, anchor, hwnd); | 551 Menu menu(this, anchor, hwnd); |
| 550 menu.AppendMenuItemWithLabel(IDC_NEW_TAB, l10n_util::GetString(IDS_NEW_TAB)); | 552 menu.AppendMenuItemWithLabel(IDC_NEW_TAB, l10n_util::GetString(IDS_NEW_TAB)); |
| 551 menu.AppendMenuItemWithLabel(IDC_NEW_WINDOW, | 553 menu.AppendMenuItemWithLabel(IDC_NEW_WINDOW, |
| 552 l10n_util::GetString(IDS_NEW_WINDOW)); | 554 l10n_util::GetString(IDS_NEW_WINDOW)); |
| 553 menu.AppendMenuItemWithLabel(IDC_NEW_INCOGNITO_WINDOW, | 555 menu.AppendMenuItemWithLabel(IDC_NEW_INCOGNITO_WINDOW, |
| 554 l10n_util::GetString(IDS_NEW_INCOGNITO_WINDOW)); | 556 l10n_util::GetString(IDS_NEW_INCOGNITO_WINDOW)); |
| 555 | 557 |
| 556 // Enumerate profiles asynchronously and then create the parent menu item. | 558 // Enumerate profiles asynchronously and then create the parent menu item. |
| 557 // We will create the child menu items for this once the asynchronous call is | 559 // We will create the child menu items for this once the asynchronous call is |
| 558 // done. See OnGetProfilesDone(). | 560 // done. See OnGetProfilesDone(). |
| 559 profiles_helper_->GetProfiles(NULL); | 561 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 560 profiles_menu_ = menu.AppendSubMenu(IDC_PROFILE_MENU, | 562 if (command_line.HasSwitch(switches::kEnableUserDataDirProfiles)) { |
| 561 l10n_util::GetString(IDS_PROFILE_MENU)); | 563 profiles_helper_->GetProfiles(NULL); |
| 564 profiles_menu_ = menu.AppendSubMenu(IDC_PROFILE_MENU, |
| 565 l10n_util::GetString(IDS_PROFILE_MENU)); |
| 566 } |
| 562 | 567 |
| 563 menu.AppendSeparator(); | 568 menu.AppendSeparator(); |
| 564 menu.AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_BAR, | 569 menu.AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_BAR, |
| 565 l10n_util::GetString(IDS_SHOW_BOOKMARK_BAR)); | 570 l10n_util::GetString(IDS_SHOW_BOOKMARK_BAR)); |
| 566 menu.AppendSeparator(); | 571 menu.AppendSeparator(); |
| 567 menu.AppendMenuItemWithLabel(IDC_SHOW_HISTORY, | 572 menu.AppendMenuItemWithLabel(IDC_SHOW_HISTORY, |
| 568 l10n_util::GetString(IDS_SHOW_HISTORY)); | 573 l10n_util::GetString(IDS_SHOW_HISTORY)); |
| 569 menu.AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_MANAGER, | 574 menu.AppendMenuItemWithLabel(IDC_SHOW_BOOKMARK_MANAGER, |
| 570 l10n_util::GetString(IDS_BOOKMARK_MANAGER)); | 575 l10n_util::GetString(IDS_BOOKMARK_MANAGER)); |
| 571 menu.AppendMenuItemWithLabel(IDC_SHOW_DOWNLOADS, | 576 menu.AppendMenuItemWithLabel(IDC_SHOW_DOWNLOADS, |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 *accel = views::Accelerator(L'C', false, true, false); | 800 *accel = views::Accelerator(L'C', false, true, false); |
| 796 return true; | 801 return true; |
| 797 case IDC_PASTE: | 802 case IDC_PASTE: |
| 798 *accel = views::Accelerator(L'V', false, true, false); | 803 *accel = views::Accelerator(L'V', false, true, false); |
| 799 return true; | 804 return true; |
| 800 } | 805 } |
| 801 // Else, we retrieve the accelerator information from the frame. | 806 // Else, we retrieve the accelerator information from the frame. |
| 802 return GetWidget()->GetAccelerator(id, accel); | 807 return GetWidget()->GetAccelerator(id, accel); |
| 803 } | 808 } |
| 804 | 809 |
| OLD | NEW |