OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2945 // displaying a favicon, which controls the throbber. If we updated it here, | 2945 // displaying a favicon, which controls the throbber. If we updated it here, |
2946 // the throbber will show the default favicon for a split second when | 2946 // the throbber will show the default favicon for a split second when |
2947 // navigating away from the new tab page. | 2947 // navigating away from the new tab page. |
2948 ScheduleUIUpdate(contents->tab_contents(), TabContents::INVALIDATE_URL); | 2948 ScheduleUIUpdate(contents->tab_contents(), TabContents::INVALIDATE_URL); |
2949 | 2949 |
2950 if (contents_is_selected) | 2950 if (contents_is_selected) |
2951 contents->tab_contents()->Focus(); | 2951 contents->tab_contents()->Focus(); |
2952 } | 2952 } |
2953 | 2953 |
2954 GURL Browser::GetHomePage() const { | 2954 GURL Browser::GetHomePage() const { |
2955 return GetHomePageForProfile(profile_); | |
2956 } | |
2957 | |
2958 // static | |
2959 GURL Browser::GetHomePageForProfile(Profile* profile) { | |
sky
2011/10/28 16:05:59
I don't think this method makes much sense on Brow
sail
2011/10/28 17:50:57
Done.
| |
2955 // --homepage overrides any preferences. | 2960 // --homepage overrides any preferences. |
2956 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2961 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
2957 if (command_line.HasSwitch(switches::kHomePage)) { | 2962 if (command_line.HasSwitch(switches::kHomePage)) { |
2958 // TODO(evanm): clean up usage of DIR_CURRENT. | 2963 // TODO(evanm): clean up usage of DIR_CURRENT. |
2959 // http://code.google.com/p/chromium/issues/detail?id=60630 | 2964 // http://code.google.com/p/chromium/issues/detail?id=60630 |
2960 // For now, allow this code to call getcwd(). | 2965 // For now, allow this code to call getcwd(). |
2961 base::ThreadRestrictions::ScopedAllowIO allow_io; | 2966 base::ThreadRestrictions::ScopedAllowIO allow_io; |
2962 | 2967 |
2963 FilePath browser_directory; | 2968 FilePath browser_directory; |
2964 PathService::Get(base::DIR_CURRENT, &browser_directory); | 2969 PathService::Get(base::DIR_CURRENT, &browser_directory); |
2965 GURL home_page(URLFixerUpper::FixupRelativeFile(browser_directory, | 2970 GURL home_page(URLFixerUpper::FixupRelativeFile(browser_directory, |
2966 command_line.GetSwitchValuePath(switches::kHomePage))); | 2971 command_line.GetSwitchValuePath(switches::kHomePage))); |
2967 if (home_page.is_valid()) | 2972 if (home_page.is_valid()) |
2968 return home_page; | 2973 return home_page; |
2969 } | 2974 } |
2970 | 2975 |
2971 if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) | 2976 if (profile->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) |
2972 return GURL(chrome::kChromeUINewTabURL); | 2977 return GURL(chrome::kChromeUINewTabURL); |
2973 GURL home_page(URLFixerUpper::FixupURL( | 2978 GURL home_page(URLFixerUpper::FixupURL( |
2974 profile_->GetPrefs()->GetString(prefs::kHomePage), | 2979 profile->GetPrefs()->GetString(prefs::kHomePage), |
2975 std::string())); | 2980 std::string())); |
2976 if (!home_page.is_valid()) | 2981 if (!home_page.is_valid()) |
2977 return GURL(chrome::kChromeUINewTabURL); | 2982 return GURL(chrome::kChromeUINewTabURL); |
2978 return home_page; | 2983 return home_page; |
2979 } | 2984 } |
2980 | 2985 |
2981 /////////////////////////////////////////////////////////////////////////////// | 2986 /////////////////////////////////////////////////////////////////////////////// |
2982 // Browser, PageNavigator implementation: | 2987 // Browser, PageNavigator implementation: |
2983 | 2988 |
2984 // TODO(adriansc): Remove this method once refactoring changed all call sites. | 2989 // TODO(adriansc): Remove this method once refactoring changed all call sites. |
(...skipping 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5507 } | 5512 } |
5508 | 5513 |
5509 void Browser::UpdateFullscreenExitBubbleContent() { | 5514 void Browser::UpdateFullscreenExitBubbleContent() { |
5510 GURL url; | 5515 GURL url; |
5511 if (fullscreened_tab_) | 5516 if (fullscreened_tab_) |
5512 url = fullscreened_tab_->tab_contents()->GetURL(); | 5517 url = fullscreened_tab_->tab_contents()->GetURL(); |
5513 | 5518 |
5514 window_->UpdateFullscreenExitBubbleContent( | 5519 window_->UpdateFullscreenExitBubbleContent( |
5515 url, GetFullscreenExitBubbleType()); | 5520 url, GetFullscreenExitBubbleType()); |
5516 } | 5521 } |
OLD | NEW |