| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "app/animation.h" | 15 #include "app/animation.h" |
| 16 #include "app/l10n_util.h" | 16 #include "app/l10n_util.h" |
| 17 #include "base/base_paths.h" | 17 #include "base/base_paths.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 21 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 23 #include "base/thread.h" | 23 #include "base/thread.h" |
| 24 #include "base/thread_restrictions.h" |
| 24 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
| 25 #include "gfx/point.h" | 26 #include "gfx/point.h" |
| 26 #include "chrome/app/chrome_dll_resource.h" | 27 #include "chrome/app/chrome_dll_resource.h" |
| 27 #include "chrome/browser/autofill/autofill_manager.h" | 28 #include "chrome/browser/autofill/autofill_manager.h" |
| 28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
| 29 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" | 30 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" |
| 30 #endif // defined(OS_WIN) | 31 #endif // defined(OS_WIN) |
| 31 #include "chrome/browser/bookmarks/bookmark_model.h" | 32 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 32 #include "chrome/browser/bookmarks/bookmark_utils.h" | 33 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 33 #include "chrome/browser/browser_list.h" | 34 #include "chrome/browser/browser_list.h" |
| (...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2329 ScheduleUIUpdate(contents, TabContents::INVALIDATE_URL); | 2330 ScheduleUIUpdate(contents, TabContents::INVALIDATE_URL); |
| 2330 | 2331 |
| 2331 if (contents_is_selected) | 2332 if (contents_is_selected) |
| 2332 contents->Focus(); | 2333 contents->Focus(); |
| 2333 } | 2334 } |
| 2334 | 2335 |
| 2335 GURL Browser::GetHomePage() const { | 2336 GURL Browser::GetHomePage() const { |
| 2336 // --homepage overrides any preferences. | 2337 // --homepage overrides any preferences. |
| 2337 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 2338 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 2338 if (command_line.HasSwitch(switches::kHomePage)) { | 2339 if (command_line.HasSwitch(switches::kHomePage)) { |
| 2340 // TODO(evanm): clean up usage of DIR_CURRENT. |
| 2341 // http://code.google.com/p/chromium/issues/detail?id=60630 |
| 2342 // For now, allow this code to call getcwd(). |
| 2343 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 2344 |
| 2339 FilePath browser_directory; | 2345 FilePath browser_directory; |
| 2340 PathService::Get(base::DIR_CURRENT, &browser_directory); | 2346 PathService::Get(base::DIR_CURRENT, &browser_directory); |
| 2341 GURL home_page(URLFixerUpper::FixupRelativeFile(browser_directory, | 2347 GURL home_page(URLFixerUpper::FixupRelativeFile(browser_directory, |
| 2342 command_line.GetSwitchValuePath(switches::kHomePage))); | 2348 command_line.GetSwitchValuePath(switches::kHomePage))); |
| 2343 if (home_page.is_valid()) | 2349 if (home_page.is_valid()) |
| 2344 return home_page; | 2350 return home_page; |
| 2345 } | 2351 } |
| 2346 | 2352 |
| 2347 if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) | 2353 if (profile_->GetPrefs()->GetBoolean(prefs::kHomePageIsNewTabPage)) |
| 2348 return GURL(chrome::kChromeUINewTabURL); | 2354 return GURL(chrome::kChromeUINewTabURL); |
| (...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4290 NOTREACHED(); | 4296 NOTREACHED(); |
| 4291 return false; | 4297 return false; |
| 4292 } | 4298 } |
| 4293 | 4299 |
| 4294 void Browser::CreateInstantIfNecessary() { | 4300 void Browser::CreateInstantIfNecessary() { |
| 4295 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && | 4301 if (type() == TYPE_NORMAL && InstantController::IsEnabled(profile()) && |
| 4296 !profile()->IsOffTheRecord()) { | 4302 !profile()->IsOffTheRecord()) { |
| 4297 instant_.reset(new InstantController(this)); | 4303 instant_.reset(new InstantController(this)); |
| 4298 } | 4304 } |
| 4299 } | 4305 } |
| OLD | NEW |