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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 ThemeServiceFactory::GetForProfile(profile_))); | 397 ThemeServiceFactory::GetForProfile(profile_))); |
398 #endif | 398 #endif |
399 registrar_.Add(this, chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, | 399 registrar_.Add(this, chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, |
400 content::NotificationService::AllSources()); | 400 content::NotificationService::AllSources()); |
401 | 401 |
402 profile_pref_registrar_.Init(profile_->GetPrefs()); | 402 profile_pref_registrar_.Init(profile_->GetPrefs()); |
403 profile_pref_registrar_.Add( | 403 profile_pref_registrar_.Add( |
404 prefs::kDevToolsDisabled, | 404 prefs::kDevToolsDisabled, |
405 base::Bind(&Browser::OnDevToolsDisabledChanged, base::Unretained(this))); | 405 base::Bind(&Browser::OnDevToolsDisabledChanged, base::Unretained(this))); |
406 profile_pref_registrar_.Add( | 406 profile_pref_registrar_.Add( |
407 prefs::kShowBookmarkBar, | 407 bookmarks::prefs::kShowBookmarkBar, |
408 base::Bind(&Browser::UpdateBookmarkBarState, base::Unretained(this), | 408 base::Bind(&Browser::UpdateBookmarkBarState, base::Unretained(this), |
409 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); | 409 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); |
410 | 410 |
411 BrowserList::AddBrowser(this); | 411 BrowserList::AddBrowser(this); |
412 | 412 |
413 // NOTE: These prefs all need to be explicitly destroyed in the destructor | 413 // NOTE: These prefs all need to be explicitly destroyed in the destructor |
414 // or you'll get a nasty surprise when you run the incognito tests. | 414 // or you'll get a nasty surprise when you run the incognito tests. |
415 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 415 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
416 profile_->GetPrefs()); | 416 profile_->GetPrefs()); |
417 | 417 |
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2351 return !!(features & feature); | 2351 return !!(features & feature); |
2352 } | 2352 } |
2353 | 2353 |
2354 void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) { | 2354 void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) { |
2355 BookmarkBar::State state; | 2355 BookmarkBar::State state; |
2356 // The bookmark bar is always hidden for Guest Sessions and in fullscreen | 2356 // The bookmark bar is always hidden for Guest Sessions and in fullscreen |
2357 // mode, unless on the new tab page. | 2357 // mode, unless on the new tab page. |
2358 if (profile_->IsGuestSession()) { | 2358 if (profile_->IsGuestSession()) { |
2359 state = BookmarkBar::HIDDEN; | 2359 state = BookmarkBar::HIDDEN; |
2360 } else if (browser_defaults::bookmarks_enabled && | 2360 } else if (browser_defaults::bookmarks_enabled && |
2361 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) && | 2361 profile_->GetPrefs()->GetBoolean(bookmarks::prefs::kShowBookmarkBar) && |
2362 !ShouldHideUIForFullscreen()) { | 2362 !ShouldHideUIForFullscreen()) { |
2363 state = BookmarkBar::SHOW; | 2363 state = BookmarkBar::SHOW; |
2364 } else { | 2364 } else { |
2365 WebContents* web_contents = tab_strip_model_->GetActiveWebContents(); | 2365 WebContents* web_contents = tab_strip_model_->GetActiveWebContents(); |
2366 BookmarkTabHelper* bookmark_tab_helper = | 2366 BookmarkTabHelper* bookmark_tab_helper = |
2367 web_contents ? BookmarkTabHelper::FromWebContents(web_contents) : NULL; | 2367 web_contents ? BookmarkTabHelper::FromWebContents(web_contents) : NULL; |
2368 if (bookmark_tab_helper && bookmark_tab_helper->ShouldShowBookmarkBar()) | 2368 if (bookmark_tab_helper && bookmark_tab_helper->ShouldShowBookmarkBar()) |
2369 state = BookmarkBar::DETACHED; | 2369 state = BookmarkBar::DETACHED; |
2370 else | 2370 else |
2371 state = BookmarkBar::HIDDEN; | 2371 state = BookmarkBar::HIDDEN; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2475 if (contents && !allow_js_access) { | 2475 if (contents && !allow_js_access) { |
2476 contents->web_contents()->GetController().LoadURL( | 2476 contents->web_contents()->GetController().LoadURL( |
2477 target_url, | 2477 target_url, |
2478 content::Referrer(), | 2478 content::Referrer(), |
2479 content::PAGE_TRANSITION_LINK, | 2479 content::PAGE_TRANSITION_LINK, |
2480 std::string()); // No extra headers. | 2480 std::string()); // No extra headers. |
2481 } | 2481 } |
2482 | 2482 |
2483 return contents != NULL; | 2483 return contents != NULL; |
2484 } | 2484 } |
OLD | NEW |