OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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/profiles/profile_window.h" | 5 #include "chrome/browser/profiles/profile_window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
13 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
14 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/history/history_service_factory.h" | 17 #include "chrome/browser/history/history_service_factory.h" |
17 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ~WaitForHistoryTask() override {} | 67 ~WaitForHistoryTask() override {} |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(WaitForHistoryTask); | 69 DISALLOW_COPY_AND_ASSIGN(WaitForHistoryTask); |
69 }; | 70 }; |
70 | 71 |
71 void WaitForHistoryBackendToRun(Profile* profile) { | 72 void WaitForHistoryBackendToRun(Profile* profile) { |
72 base::CancelableTaskTracker task_tracker; | 73 base::CancelableTaskTracker task_tracker; |
73 scoped_ptr<history::HistoryDBTask> task(new WaitForHistoryTask()); | 74 scoped_ptr<history::HistoryDBTask> task(new WaitForHistoryTask()); |
74 history::HistoryService* history = HistoryServiceFactory::GetForProfile( | 75 history::HistoryService* history = HistoryServiceFactory::GetForProfile( |
75 profile, ServiceAccessType::EXPLICIT_ACCESS); | 76 profile, ServiceAccessType::EXPLICIT_ACCESS); |
76 history->ScheduleDBTask(task.Pass(), &task_tracker); | 77 history->ScheduleDBTask(std::move(task), &task_tracker); |
77 content::RunMessageLoop(); | 78 content::RunMessageLoop(); |
78 } | 79 } |
79 | 80 |
80 class EmptyAcceleratorHandler : public ui::AcceleratorProvider { | 81 class EmptyAcceleratorHandler : public ui::AcceleratorProvider { |
81 public: | 82 public: |
82 // Don't handle accelerators. | 83 // Don't handle accelerators. |
83 bool GetAcceleratorForCommandId(int command_id, | 84 bool GetAcceleratorForCommandId(int command_id, |
84 ui::Accelerator* accelerator) override { | 85 ui::Accelerator* accelerator) override { |
85 return false; | 86 return false; |
86 } | 87 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 AppMenuModel model_normal_profile(&accelerator_handler, browser()); | 210 AppMenuModel model_normal_profile(&accelerator_handler, browser()); |
210 EXPECT_NE(-1, model_normal_profile.GetIndexOfCommandId(IDC_BOOKMARKS_MENU)); | 211 EXPECT_NE(-1, model_normal_profile.GetIndexOfCommandId(IDC_BOOKMARKS_MENU)); |
211 | 212 |
212 // Guest browser has no bookmark menu. | 213 // Guest browser has no bookmark menu. |
213 Browser* guest_browser = OpenGuestBrowser(); | 214 Browser* guest_browser = OpenGuestBrowser(); |
214 AppMenuModel model_guest_profile(&accelerator_handler, guest_browser); | 215 AppMenuModel model_guest_profile(&accelerator_handler, guest_browser); |
215 EXPECT_EQ(-1, model_guest_profile.GetIndexOfCommandId(IDC_BOOKMARKS_MENU)); | 216 EXPECT_EQ(-1, model_guest_profile.GetIndexOfCommandId(IDC_BOOKMARKS_MENU)); |
216 } | 217 } |
217 | 218 |
218 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) | 219 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
OLD | NEW |