| OLD | NEW |
| 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/startup/startup_browser_creator_impl.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/app_restore_service.h" | 10 #include "apps/app_restore_service.h" |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 const StartupTabs& tabs, | 772 const StartupTabs& tabs, |
| 773 chrome::HostDesktopType desktop_type) { | 773 chrome::HostDesktopType desktop_type) { |
| 774 DCHECK(!tabs.empty()); | 774 DCHECK(!tabs.empty()); |
| 775 | 775 |
| 776 // If we don't yet have a profile, try to use the one we're given from | 776 // If we don't yet have a profile, try to use the one we're given from |
| 777 // |browser|. While we may not end up actually using |browser| (since it | 777 // |browser|. While we may not end up actually using |browser| (since it |
| 778 // could be a popup window), we can at least use the profile. | 778 // could be a popup window), we can at least use the profile. |
| 779 if (!profile_ && browser) | 779 if (!profile_ && browser) |
| 780 profile_ = browser->profile(); | 780 profile_ = browser->profile(); |
| 781 | 781 |
| 782 if (!browser || !browser->is_type_tabbed()) { | 782 if (!browser || !browser->is_type_tabbed()) |
| 783 browser = new Browser(Browser::CreateParams(profile_, desktop_type)); | 783 browser = new Browser(Browser::CreateParams(profile_, desktop_type)); |
| 784 } else { | |
| 785 #if defined(TOOLKIT_GTK) | |
| 786 // Setting the time of the last action on the window here allows us to steal | |
| 787 // focus, which is what the user wants when opening a new tab in an existing | |
| 788 // browser window. | |
| 789 gtk_util::SetWMLastUserActionTime(browser->window()->GetNativeWindow()); | |
| 790 #endif | |
| 791 } | |
| 792 | 784 |
| 793 bool first_tab = true; | 785 bool first_tab = true; |
| 794 ProtocolHandlerRegistry* registry = profile_ ? | 786 ProtocolHandlerRegistry* registry = profile_ ? |
| 795 ProtocolHandlerRegistryFactory::GetForProfile(profile_) : NULL; | 787 ProtocolHandlerRegistryFactory::GetForProfile(profile_) : NULL; |
| 796 for (size_t i = 0; i < tabs.size(); ++i) { | 788 for (size_t i = 0; i < tabs.size(); ++i) { |
| 797 // We skip URLs that we'd have to launch an external protocol handler for. | 789 // We skip URLs that we'd have to launch an external protocol handler for. |
| 798 // This avoids us getting into an infinite loop asking ourselves to open | 790 // This avoids us getting into an infinite loop asking ourselves to open |
| 799 // a URL, should the handler be (incorrectly) configured to be us. Anyone | 791 // a URL, should the handler be (incorrectly) configured to be us. Anyone |
| 800 // asking us to open such a URL should really ask the handler directly. | 792 // asking us to open such a URL should really ask the handler directly. |
| 801 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || | 793 bool handled_by_chrome = ProfileIOData::IsHandledURL(tabs[i].url) || |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 } | 942 } |
| 951 | 943 |
| 952 #if !defined(OS_WIN) | 944 #if !defined(OS_WIN) |
| 953 // static | 945 // static |
| 954 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( | 946 bool StartupBrowserCreatorImpl::OpenStartupURLsInExistingBrowser( |
| 955 Profile* profile, | 947 Profile* profile, |
| 956 const std::vector<GURL>& startup_urls) { | 948 const std::vector<GURL>& startup_urls) { |
| 957 return false; | 949 return false; |
| 958 } | 950 } |
| 959 #endif | 951 #endif |
| OLD | NEW |