OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 12 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_shutdown.h" | |
14 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 15 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
15 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 16 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
16 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 17 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
17 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" | 18 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/devtools/devtools_window.h" | 20 #include "chrome/browser/devtools/devtools_window.h" |
20 #include "chrome/browser/dom_distiller/tab_utils.h" | 21 #include "chrome/browser/dom_distiller/tab_utils.h" |
21 #include "chrome/browser/lifetime/application_lifetime.h" | 22 #include "chrome/browser/lifetime/application_lifetime.h" |
22 #include "chrome/browser/media/router/media_router_feature.h" | 23 #include "chrome/browser/media/router/media_router_feature.h" |
23 #include "chrome/browser/platform_util.h" | 24 #include "chrome/browser/platform_util.h" |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 TabStripModel* tab_strip = browser->tab_strip_model(); | 750 TabStripModel* tab_strip = browser->tab_strip_model(); |
750 WebContents* contents = | 751 WebContents* contents = |
751 tab_strip->DetachWebContentsAt(tab_strip->active_index()); | 752 tab_strip->DetachWebContentsAt(tab_strip->active_index()); |
752 Browser* b = new Browser(Browser::CreateParams(browser->profile(), true)); | 753 Browser* b = new Browser(Browser::CreateParams(browser->profile(), true)); |
753 b->tab_strip_model()->AppendWebContents(contents, true); | 754 b->tab_strip_model()->AppendWebContents(contents, true); |
754 b->window()->Show(); | 755 b->window()->Show(); |
755 } | 756 } |
756 | 757 |
757 void Exit() { | 758 void Exit() { |
758 content::RecordAction(UserMetricsAction("Exit")); | 759 content::RecordAction(UserMetricsAction("Exit")); |
760 // On Mac, the platform-specific part handles setting this. | |
761 #if !defined(OS_MACOSX) | |
762 browser_shutdown::SetTryingToQuit(true); | |
Alexey Seren
2017/04/09 17:51:37
By comments for SetTryingToQuit function we should
hashimoto
2017/04/14 08:54:37
IIUC the comment discourages to call SetTryingToQu
| |
763 #endif | |
759 chrome::AttemptUserExit(); | 764 chrome::AttemptUserExit(); |
760 } | 765 } |
761 | 766 |
762 void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser) { | 767 void BookmarkCurrentPageIgnoringExtensionOverrides(Browser* browser) { |
763 content::RecordAction(UserMetricsAction("Star")); | 768 content::RecordAction(UserMetricsAction("Star")); |
764 | 769 |
765 BookmarkModel* model = | 770 BookmarkModel* model = |
766 BookmarkModelFactory::GetForBrowserContext(browser->profile()); | 771 BookmarkModelFactory::GetForBrowserContext(browser->profile()); |
767 if (!model || !model->loaded()) | 772 if (!model || !model->loaded()) |
768 return; // Ignore requests until bookmarks are loaded. | 773 return; // Ignore requests until bookmarks are loaded. |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1334 true)); | 1339 true)); |
1335 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1340 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1336 | 1341 |
1337 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1342 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1338 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1343 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1339 app_browser->window()->Show(); | 1344 app_browser->window()->Show(); |
1340 } | 1345 } |
1341 #endif // BUILDFLAG(ENABLE_EXTENSIONS) | 1346 #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
1342 | 1347 |
1343 } // namespace chrome | 1348 } // namespace chrome |
OLD | NEW |