| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 #include "chrome/browser/themes/theme_service_factory.h" | 87 #include "chrome/browser/themes/theme_service_factory.h" |
| 88 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 88 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 89 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 89 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 90 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 90 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
| 91 #include "chrome/browser/ui/browser_dialogs.h" | 91 #include "chrome/browser/ui/browser_dialogs.h" |
| 92 #include "chrome/browser/ui/browser_list.h" | 92 #include "chrome/browser/ui/browser_list.h" |
| 93 #include "chrome/browser/ui/browser_navigator.h" | 93 #include "chrome/browser/ui/browser_navigator.h" |
| 94 #include "chrome/browser/ui/browser_synced_window_delegate.h" | 94 #include "chrome/browser/ui/browser_synced_window_delegate.h" |
| 95 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 95 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 96 #include "chrome/browser/ui/browser_window.h" | 96 #include "chrome/browser/ui/browser_window.h" |
| 97 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 97 #include "chrome/browser/ui/find_bar/find_bar.h" | 98 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 98 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 99 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 99 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 100 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 100 #include "chrome/browser/ui/global_error.h" | 101 #include "chrome/browser/ui/global_error.h" |
| 101 #include "chrome/browser/ui/global_error_service.h" | 102 #include "chrome/browser/ui/global_error_service.h" |
| 102 #include "chrome/browser/ui/global_error_service_factory.h" | 103 #include "chrome/browser/ui/global_error_service_factory.h" |
| 103 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" | 104 #include "chrome/browser/ui/intents/web_intent_picker_controller.h" |
| 104 #include "chrome/browser/ui/omnibox/location_bar.h" | 105 #include "chrome/browser/ui/omnibox/location_bar.h" |
| 105 #include "chrome/browser/ui/panels/panel.h" | 106 #include "chrome/browser/ui/panels/panel.h" |
| 106 #include "chrome/browser/ui/panels/panel_manager.h" | 107 #include "chrome/browser/ui/panels/panel_manager.h" |
| (...skipping 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3503 } | 3504 } |
| 3504 | 3505 |
| 3505 bool Browser::UseVerticalTabs() const { | 3506 bool Browser::UseVerticalTabs() const { |
| 3506 return use_vertical_tabs_.GetValue(); | 3507 return use_vertical_tabs_.GetValue(); |
| 3507 } | 3508 } |
| 3508 | 3509 |
| 3509 void Browser::ContentsZoomChange(bool zoom_in) { | 3510 void Browser::ContentsZoomChange(bool zoom_in) { |
| 3510 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); | 3511 ExecuteCommand(zoom_in ? IDC_ZOOM_PLUS : IDC_ZOOM_MINUS); |
| 3511 } | 3512 } |
| 3512 | 3513 |
| 3513 void Browser::SetTabContentBlocked(TabContents* contents, bool blocked) { | |
| 3514 int index = tabstrip_model()->GetWrapperIndex(contents); | |
| 3515 if (index == TabStripModel::kNoTab) { | |
| 3516 NOTREACHED(); | |
| 3517 return; | |
| 3518 } | |
| 3519 tabstrip_model()->SetTabBlocked(index, blocked); | |
| 3520 } | |
| 3521 | |
| 3522 void Browser::TabContentsFocused(TabContents* tab_content) { | 3514 void Browser::TabContentsFocused(TabContents* tab_content) { |
| 3523 window_->TabContentsFocused(tab_content); | 3515 window_->TabContentsFocused(tab_content); |
| 3524 } | 3516 } |
| 3525 | 3517 |
| 3526 bool Browser::TakeFocus(bool reverse) { | 3518 bool Browser::TakeFocus(bool reverse) { |
| 3527 NotificationService::current()->Notify( | 3519 NotificationService::current()->Notify( |
| 3528 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, | 3520 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, |
| 3529 Source<Browser>(this), | 3521 Source<Browser>(this), |
| 3530 NotificationService::NoDetails()); | 3522 NotificationService::NoDetails()); |
| 3531 return false; | 3523 return false; |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4155 | 4147 |
| 4156 void Browser::SwapTabContents(TabContentsWrapper* old_tab_contents, | 4148 void Browser::SwapTabContents(TabContentsWrapper* old_tab_contents, |
| 4157 TabContentsWrapper* new_tab_contents) { | 4149 TabContentsWrapper* new_tab_contents) { |
| 4158 int index = | 4150 int index = |
| 4159 tab_handler_->GetTabStripModel()->GetIndexOfTabContents(old_tab_contents); | 4151 tab_handler_->GetTabStripModel()->GetIndexOfTabContents(old_tab_contents); |
| 4160 DCHECK_NE(TabStripModel::kNoTab, index); | 4152 DCHECK_NE(TabStripModel::kNoTab, index); |
| 4161 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt(index, | 4153 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt(index, |
| 4162 new_tab_contents); | 4154 new_tab_contents); |
| 4163 } | 4155 } |
| 4164 | 4156 |
| 4157 void Browser::SetTabContentBlocked(TabContentsWrapper* wrapper, bool blocked) { |
| 4158 int index = tabstrip_model()->GetIndexOfTabContents(wrapper); |
| 4159 if (index == TabStripModel::kNoTab) { |
| 4160 NOTREACHED(); |
| 4161 return; |
| 4162 } |
| 4163 tabstrip_model()->SetTabBlocked(index, blocked); |
| 4164 } |
| 4165 |
| 4165 void Browser::SetSuggestedText(const string16& text, | 4166 void Browser::SetSuggestedText(const string16& text, |
| 4166 InstantCompleteBehavior behavior) { | 4167 InstantCompleteBehavior behavior) { |
| 4167 if (window()->GetLocationBar()) | 4168 if (window()->GetLocationBar()) |
| 4168 window()->GetLocationBar()->SetSuggestedText(text, behavior); | 4169 window()->GetLocationBar()->SetSuggestedText(text, behavior); |
| 4169 } | 4170 } |
| 4170 | 4171 |
| 4171 gfx::Rect Browser::GetInstantBounds() { | 4172 gfx::Rect Browser::GetInstantBounds() { |
| 4172 return window()->GetInstantBounds(); | 4173 return window()->GetInstantBounds(); |
| 4173 } | 4174 } |
| 4174 | 4175 |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4934 } | 4935 } |
| 4935 | 4936 |
| 4936 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) { | 4937 void Browser::SetAsDelegate(TabContentsWrapper* tab, Browser* delegate) { |
| 4937 // TabContents... | 4938 // TabContents... |
| 4938 tab->tab_contents()->set_delegate(delegate); | 4939 tab->tab_contents()->set_delegate(delegate); |
| 4939 tab->set_delegate(delegate); | 4940 tab->set_delegate(delegate); |
| 4940 | 4941 |
| 4941 // ...and all the helpers. | 4942 // ...and all the helpers. |
| 4942 tab->blocked_content_tab_helper()->set_delegate(delegate); | 4943 tab->blocked_content_tab_helper()->set_delegate(delegate); |
| 4943 tab->bookmark_tab_helper()->set_delegate(delegate); | 4944 tab->bookmark_tab_helper()->set_delegate(delegate); |
| 4945 tab->constrained_window_tab_helper()->set_delegate(delegate); |
| 4944 tab->search_engine_tab_helper()->set_delegate(delegate); | 4946 tab->search_engine_tab_helper()->set_delegate(delegate); |
| 4945 } | 4947 } |
| 4946 | 4948 |
| 4947 void Browser::FindInPage(bool find_next, bool forward_direction) { | 4949 void Browser::FindInPage(bool find_next, bool forward_direction) { |
| 4948 ShowFindBar(); | 4950 ShowFindBar(); |
| 4949 if (find_next) { | 4951 if (find_next) { |
| 4950 string16 find_text; | 4952 string16 find_text; |
| 4951 #if defined(OS_MACOSX) | 4953 #if defined(OS_MACOSX) |
| 4952 // We always want to search for the contents of the find pasteboard on OS X. | 4954 // We always want to search for the contents of the find pasteboard on OS X. |
| 4953 find_text = GetFindPboardText(); | 4955 find_text = GetFindPboardText(); |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5245 } else if (is_type_tabbed()) { | 5247 } else if (is_type_tabbed()) { |
| 5246 GlobalErrorService* service = | 5248 GlobalErrorService* service = |
| 5247 GlobalErrorServiceFactory::GetForProfile(profile()); | 5249 GlobalErrorServiceFactory::GetForProfile(profile()); |
| 5248 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 5250 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
| 5249 if (error) { | 5251 if (error) { |
| 5250 error->ShowBubbleView(this); | 5252 error->ShowBubbleView(this); |
| 5251 did_show_bubble = true; | 5253 did_show_bubble = true; |
| 5252 } | 5254 } |
| 5253 } | 5255 } |
| 5254 } | 5256 } |
| OLD | NEW |