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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 #include "chrome/browser/ui/tab_dialogs.h" | 128 #include "chrome/browser/ui/tab_dialogs.h" |
129 #include "chrome/browser/ui/tab_helpers.h" | 129 #include "chrome/browser/ui/tab_helpers.h" |
130 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 130 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
131 #include "chrome/browser/ui/tabs/tab_menu_model.h" | 131 #include "chrome/browser/ui/tabs/tab_menu_model.h" |
132 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 132 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
133 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" | 133 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" |
134 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" | 134 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" |
135 #include "chrome/browser/ui/unload_controller.h" | 135 #include "chrome/browser/ui/unload_controller.h" |
136 #include "chrome/browser/ui/validation_message_bubble.h" | 136 #include "chrome/browser/ui/validation_message_bubble.h" |
137 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 137 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 138 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" |
138 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 139 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
139 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 140 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
140 #include "chrome/browser/ui/window_sizer/window_sizer.h" | 141 #include "chrome/browser/ui/window_sizer/window_sizer.h" |
141 #include "chrome/browser/upgrade_detector.h" | 142 #include "chrome/browser/upgrade_detector.h" |
142 #include "chrome/common/chrome_constants.h" | 143 #include "chrome/common/chrome_constants.h" |
143 #include "chrome/common/chrome_switches.h" | 144 #include "chrome/common/chrome_switches.h" |
144 #include "chrome/common/custom_handlers/protocol_handler.h" | 145 #include "chrome/common/custom_handlers/protocol_handler.h" |
145 #include "chrome/common/pref_names.h" | 146 #include "chrome/common/pref_names.h" |
146 #include "chrome/common/profiling.h" | 147 #include "chrome/common/profiling.h" |
147 #include "chrome/common/search_types.h" | 148 #include "chrome/common/search_types.h" |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 // Reset the status bubble. | 1060 // Reset the status bubble. |
1060 StatusBubble* status_bubble = GetStatusBubble(); | 1061 StatusBubble* status_bubble = GetStatusBubble(); |
1061 if (status_bubble) { | 1062 if (status_bubble) { |
1062 status_bubble->Hide(); | 1063 status_bubble->Hide(); |
1063 | 1064 |
1064 // Show the loading state (if any). | 1065 // Show the loading state (if any). |
1065 status_bubble->SetStatus(CoreTabHelper::FromWebContents( | 1066 status_bubble->SetStatus(CoreTabHelper::FromWebContents( |
1066 tab_strip_model_->GetActiveWebContents())->GetStatusText()); | 1067 tab_strip_model_->GetActiveWebContents())->GetStatusText()); |
1067 } | 1068 } |
1068 | 1069 |
| 1070 TransferPermissionBubble(old_contents, new_contents); |
| 1071 |
1069 if (HasFindBarController()) { | 1072 if (HasFindBarController()) { |
1070 find_bar_controller_->ChangeWebContents(new_contents); | 1073 find_bar_controller_->ChangeWebContents(new_contents); |
1071 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect()); | 1074 find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect()); |
1072 } | 1075 } |
1073 | 1076 |
1074 // Update sessions. Don't force creation of sessions. If sessions doesn't | 1077 // Update sessions. Don't force creation of sessions. If sessions doesn't |
1075 // exist, the change will be picked up by sessions when created. | 1078 // exist, the change will be picked up by sessions when created. |
1076 SessionService* session_service = | 1079 SessionService* session_service = |
1077 SessionServiceFactory::GetForProfileIfExisting(profile_); | 1080 SessionServiceFactory::GetForProfileIfExisting(profile_); |
1078 if (session_service && !tab_strip_model_->closing_all()) { | 1081 if (session_service && !tab_strip_model_->closing_all()) { |
(...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 tracked_objects::ScopedTracker tracking_profile3( | 2513 tracked_objects::ScopedTracker tracking_profile3( |
2511 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 2514 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
2512 "467185 Browser::UpdateBookmarkBarState3")); | 2515 "467185 Browser::UpdateBookmarkBarState3")); |
2513 | 2516 |
2514 bool should_animate = reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE; | 2517 bool should_animate = reason == BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE; |
2515 window_->BookmarkBarStateChanged(should_animate ? | 2518 window_->BookmarkBarStateChanged(should_animate ? |
2516 BookmarkBar::ANIMATE_STATE_CHANGE : | 2519 BookmarkBar::ANIMATE_STATE_CHANGE : |
2517 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); | 2520 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); |
2518 } | 2521 } |
2519 | 2522 |
| 2523 void Browser::TransferPermissionBubble(WebContents* old_contents, |
| 2524 WebContents* new_contents) { |
| 2525 // No need to manually remove the old bubble - the old manager |
| 2526 // will automatically close it. |
| 2527 PermissionBubbleManager* manager(nullptr); |
| 2528 if (old_contents) { |
| 2529 manager = PermissionBubbleManager::FromWebContents(old_contents); |
| 2530 if (manager) |
| 2531 manager->SetView(nullptr); |
| 2532 } |
| 2533 |
| 2534 if (new_contents) { |
| 2535 if (!permission_bubble_.get()) |
| 2536 permission_bubble_.reset(PermissionBubbleView::Create(this)); |
| 2537 manager = PermissionBubbleManager::FromWebContents(new_contents); |
| 2538 if (manager) |
| 2539 manager->SetView(permission_bubble_.get()); |
| 2540 } |
| 2541 } |
| 2542 |
2520 bool Browser::ShouldHideUIForFullscreen() const { | 2543 bool Browser::ShouldHideUIForFullscreen() const { |
2521 // Windows and GTK remove the top controls in fullscreen, but Mac and Ash | 2544 // Windows and GTK remove the top controls in fullscreen, but Mac and Ash |
2522 // keep the controls in a slide-down panel. | 2545 // keep the controls in a slide-down panel. |
2523 return window_ && window_->ShouldHideUIForFullscreen(); | 2546 return window_ && window_->ShouldHideUIForFullscreen(); |
2524 } | 2547 } |
2525 | 2548 |
2526 bool Browser::MaybeCreateBackgroundContents( | 2549 bool Browser::MaybeCreateBackgroundContents( |
2527 int route_id, | 2550 int route_id, |
2528 int main_frame_route_id, | 2551 int main_frame_route_id, |
2529 WebContents* opener_web_contents, | 2552 WebContents* opener_web_contents, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2603 if (contents && !allow_js_access) { | 2626 if (contents && !allow_js_access) { |
2604 contents->web_contents()->GetController().LoadURL( | 2627 contents->web_contents()->GetController().LoadURL( |
2605 target_url, | 2628 target_url, |
2606 content::Referrer(), | 2629 content::Referrer(), |
2607 ui::PAGE_TRANSITION_LINK, | 2630 ui::PAGE_TRANSITION_LINK, |
2608 std::string()); // No extra headers. | 2631 std::string()); // No extra headers. |
2609 } | 2632 } |
2610 | 2633 |
2611 return contents != NULL; | 2634 return contents != NULL; |
2612 } | 2635 } |
OLD | NEW |