Chromium Code Reviews| 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 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 #include "chrome/browser/ui/browser_navigator.h" | 102 #include "chrome/browser/ui/browser_navigator.h" |
| 103 #include "chrome/browser/ui/browser_navigator_params.h" | 103 #include "chrome/browser/ui/browser_navigator_params.h" |
| 104 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" | 104 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h" |
| 105 #include "chrome/browser/ui/browser_tabstrip.h" | 105 #include "chrome/browser/ui/browser_tabstrip.h" |
| 106 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" | 106 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" |
| 107 #include "chrome/browser/ui/browser_ui_prefs.h" | 107 #include "chrome/browser/ui/browser_ui_prefs.h" |
| 108 #include "chrome/browser/ui/browser_window.h" | 108 #include "chrome/browser/ui/browser_window.h" |
| 109 #include "chrome/browser/ui/chrome_bubble_manager.h" | 109 #include "chrome/browser/ui/chrome_bubble_manager.h" |
| 110 #include "chrome/browser/ui/chrome_pages.h" | 110 #include "chrome/browser/ui/chrome_pages.h" |
| 111 #include "chrome/browser/ui/chrome_select_file_policy.h" | 111 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 112 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | |
| 112 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 113 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 113 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" | 114 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" |
| 114 #include "chrome/browser/ui/extensions/hosted_app_browser_controller.h" | 115 #include "chrome/browser/ui/extensions/hosted_app_browser_controller.h" |
| 115 #include "chrome/browser/ui/fast_unload_controller.h" | 116 #include "chrome/browser/ui/fast_unload_controller.h" |
| 116 #include "chrome/browser/ui/find_bar/find_bar.h" | 117 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 117 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 118 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 118 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 119 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 119 #include "chrome/browser/ui/global_error/global_error.h" | 120 #include "chrome/browser/ui/global_error/global_error.h" |
| 120 #include "chrome/browser/ui/global_error/global_error_service.h" | 121 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 121 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 122 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 content::NotificationService::AllSources()); | 428 content::NotificationService::AllSources()); |
| 428 | 429 |
| 429 profile_pref_registrar_.Init(profile_->GetPrefs()); | 430 profile_pref_registrar_.Init(profile_->GetPrefs()); |
| 430 profile_pref_registrar_.Add( | 431 profile_pref_registrar_.Add( |
| 431 prefs::kDevToolsDisabled, | 432 prefs::kDevToolsDisabled, |
| 432 base::Bind(&Browser::OnDevToolsDisabledChanged, base::Unretained(this))); | 433 base::Bind(&Browser::OnDevToolsDisabledChanged, base::Unretained(this))); |
| 433 profile_pref_registrar_.Add( | 434 profile_pref_registrar_.Add( |
| 434 bookmarks::prefs::kShowBookmarkBar, | 435 bookmarks::prefs::kShowBookmarkBar, |
| 435 base::Bind(&Browser::UpdateBookmarkBarState, base::Unretained(this), | 436 base::Bind(&Browser::UpdateBookmarkBarState, base::Unretained(this), |
| 436 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); | 437 BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE)); |
| 438 profile_pref_registrar_.Add( | |
|
Robert Sesek
2016/02/26 20:42:27
Seems like this should be limited to OS_MACOSX? Bu
spqchan
2016/02/26 23:24:59
Good point. I was following what "Always Show Book
| |
| 439 prefs::kShowFullscreenToolbar, | |
| 440 base::Bind(&Browser::UpdateFullscreenToolbar, base::Unretained(this))); | |
| 437 | 441 |
| 438 // NOTE: These prefs all need to be explicitly destroyed in the destructor | 442 // NOTE: These prefs all need to be explicitly destroyed in the destructor |
| 439 // or you'll get a nasty surprise when you run the incognito tests. | 443 // or you'll get a nasty surprise when you run the incognito tests. |
| 440 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, | 444 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, |
| 441 profile_->GetPrefs()); | 445 profile_->GetPrefs()); |
| 442 | 446 |
| 443 if (search::IsInstantExtendedAPIEnabled() && is_type_tabbed()) | 447 if (search::IsInstantExtendedAPIEnabled() && is_type_tabbed()) |
| 444 instant_controller_.reset(new BrowserInstantController(this)); | 448 instant_controller_.reset(new BrowserInstantController(this)); |
| 445 | 449 |
| 446 if (extensions::HostedAppBrowserController::IsForHostedApp(this)) { | 450 if (extensions::HostedAppBrowserController::IsForHostedApp(this)) { |
| (...skipping 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2638 tracked_objects::ScopedTracker tracking_profile3( | 2642 tracked_objects::ScopedTracker tracking_profile3( |
| 2639 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 2643 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 2640 "467185 Browser::UpdateBookmarkBarState3")); | 2644 "467185 Browser::UpdateBookmarkBarState3")); |
| 2641 | 2645 |
| 2642 bool should_animate = reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE; | 2646 bool should_animate = reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE; |
| 2643 window_->BookmarkBarStateChanged(should_animate ? | 2647 window_->BookmarkBarStateChanged(should_animate ? |
| 2644 BookmarkBar::ANIMATE_STATE_CHANGE : | 2648 BookmarkBar::ANIMATE_STATE_CHANGE : |
| 2645 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 2649 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
| 2646 } | 2650 } |
| 2647 | 2651 |
| 2652 void Browser::UpdateFullscreenToolbar() { | |
| 2653 exclusive_access_manager()->context()->UpdateFullscreenToolbar(); | |
| 2654 } | |
| 2655 | |
| 2648 bool Browser::ShouldHideUIForFullscreen() const { | 2656 bool Browser::ShouldHideUIForFullscreen() const { |
| 2649 // Windows and GTK remove the top controls in fullscreen, but Mac and Ash | 2657 // Windows and GTK remove the top controls in fullscreen, but Mac and Ash |
| 2650 // keep the controls in a slide-down panel. | 2658 // keep the controls in a slide-down panel. |
| 2651 return window_ && window_->ShouldHideUIForFullscreen(); | 2659 return window_ && window_->ShouldHideUIForFullscreen(); |
| 2652 } | 2660 } |
| 2653 | 2661 |
| 2654 bool Browser::ShouldStartShutdown() const { | 2662 bool Browser::ShouldStartShutdown() const { |
| 2655 return BrowserList::GetInstance()->size() <= 1; | 2663 return BrowserList::GetInstance()->size() <= 1; |
| 2656 } | 2664 } |
| 2657 | 2665 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2732 if (contents && !allow_js_access) { | 2740 if (contents && !allow_js_access) { |
| 2733 contents->web_contents()->GetController().LoadURL( | 2741 contents->web_contents()->GetController().LoadURL( |
| 2734 target_url, | 2742 target_url, |
| 2735 content::Referrer(), | 2743 content::Referrer(), |
| 2736 ui::PAGE_TRANSITION_LINK, | 2744 ui::PAGE_TRANSITION_LINK, |
| 2737 std::string()); // No extra headers. | 2745 std::string()); // No extra headers. |
| 2738 } | 2746 } |
| 2739 | 2747 |
| 2740 return contents != NULL; | 2748 return contents != NULL; |
| 2741 } | 2749 } |
| OLD | NEW |