| 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.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 // defined(OS_WIN) | 10 #endif // defined(OS_WIN) |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 content::NotificationService::AllSources()); | 373 content::NotificationService::AllSources()); |
| 374 | 374 |
| 375 profile_pref_registrar_.Init(profile_->GetPrefs()); | 375 profile_pref_registrar_.Init(profile_->GetPrefs()); |
| 376 profile_pref_registrar_.Add( | 376 profile_pref_registrar_.Add( |
| 377 prefs::kDevToolsDisabled, | 377 prefs::kDevToolsDisabled, |
| 378 base::Bind(&Browser::OnDevToolsDisabledChanged, base::Unretained(this))); | 378 base::Bind(&Browser::OnDevToolsDisabledChanged, base::Unretained(this))); |
| 379 profile_pref_registrar_.Add( | 379 profile_pref_registrar_.Add( |
| 380 prefs::kShowBookmarkBar, | 380 prefs::kShowBookmarkBar, |
| 381 base::Bind(&Browser::UpdateBookmarkBarState, base::Unretained(this), | 381 base::Bind(&Browser::UpdateBookmarkBarState, base::Unretained(this), |
| 382 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); | 382 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); |
| 383 profile_pref_registrar_.Add( | |
| 384 prefs::kHomePage, | |
| 385 base::Bind(&Browser::MarkHomePageAsChanged, base::Unretained(this))); | |
| 386 | 383 |
| 387 BrowserList::AddBrowser(this); | 384 BrowserList::AddBrowser(this); |
| 388 | 385 |
| 389 // NOTE: These prefs all need to be explicitly destroyed in the destructor | 386 // NOTE: These prefs all need to be explicitly destroyed in the destructor |
| 390 // or you'll get a nasty surprise when you run the incognito tests. | 387 // or you'll get a nasty surprise when you run the incognito tests. |
| 391 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 388 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
| 392 profile_->GetPrefs()); | 389 profile_->GetPrefs()); |
| 393 | 390 |
| 394 if (is_type_tabbed()) | 391 if (is_type_tabbed()) |
| 395 instant_controller_.reset(new BrowserInstantController(this)); | 392 instant_controller_.reset(new BrowserInstantController(this)); |
| (...skipping 1404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1800 } | 1797 } |
| 1801 | 1798 |
| 1802 /////////////////////////////////////////////////////////////////////////////// | 1799 /////////////////////////////////////////////////////////////////////////////// |
| 1803 // Browser, Command and state updating (private): | 1800 // Browser, Command and state updating (private): |
| 1804 | 1801 |
| 1805 void Browser::OnDevToolsDisabledChanged() { | 1802 void Browser::OnDevToolsDisabledChanged() { |
| 1806 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) | 1803 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) |
| 1807 content::DevToolsManager::GetInstance()->CloseAllClientHosts(); | 1804 content::DevToolsManager::GetInstance()->CloseAllClientHosts(); |
| 1808 } | 1805 } |
| 1809 | 1806 |
| 1810 void Browser::MarkHomePageAsChanged() { | |
| 1811 profile_->GetPrefs()->SetBoolean(prefs::kHomePageChanged, true); | |
| 1812 } | |
| 1813 | |
| 1814 /////////////////////////////////////////////////////////////////////////////// | 1807 /////////////////////////////////////////////////////////////////////////////// |
| 1815 // Browser, UI update coalescing and handling (private): | 1808 // Browser, UI update coalescing and handling (private): |
| 1816 | 1809 |
| 1817 void Browser::UpdateToolbar(bool should_restore_state) { | 1810 void Browser::UpdateToolbar(bool should_restore_state) { |
| 1818 window_->UpdateToolbar(tab_strip_model_->GetActiveWebContents(), | 1811 window_->UpdateToolbar(tab_strip_model_->GetActiveWebContents(), |
| 1819 should_restore_state); | 1812 should_restore_state); |
| 1820 } | 1813 } |
| 1821 | 1814 |
| 1822 void Browser::UpdateSearchState(WebContents* contents) { | 1815 void Browser::UpdateSearchState(WebContents* contents) { |
| 1823 if (chrome::IsInstantExtendedAPIEnabled()) | 1816 if (chrome::IsInstantExtendedAPIEnabled()) |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 if (contents && !allow_js_access) { | 2226 if (contents && !allow_js_access) { |
| 2234 contents->web_contents()->GetController().LoadURL( | 2227 contents->web_contents()->GetController().LoadURL( |
| 2235 target_url, | 2228 target_url, |
| 2236 content::Referrer(), | 2229 content::Referrer(), |
| 2237 content::PAGE_TRANSITION_LINK, | 2230 content::PAGE_TRANSITION_LINK, |
| 2238 std::string()); // No extra headers. | 2231 std::string()); // No extra headers. |
| 2239 } | 2232 } |
| 2240 | 2233 |
| 2241 return contents != NULL; | 2234 return contents != NULL; |
| 2242 } | 2235 } |
| OLD | NEW |