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 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2519 | 2519 |
2520 DLOG(INFO) << "Browser tab contents received intent:" | 2520 DLOG(INFO) << "Browser tab contents received intent:" |
2521 << "\naction=" << UTF16ToASCII(action) | 2521 << "\naction=" << UTF16ToASCII(action) |
2522 << "\ntype=" << UTF16ToASCII(type) | 2522 << "\ntype=" << UTF16ToASCII(type) |
2523 << "\nrenderer_id=" << routing_id | 2523 << "\nrenderer_id=" << routing_id |
2524 << "\nid=" << intent_id; | 2524 << "\nid=" << intent_id; |
2525 | 2525 |
2526 tcw->web_intent_picker_controller()->ShowDialog(action, type); | 2526 tcw->web_intent_picker_controller()->ShowDialog(action, type); |
2527 } | 2527 } |
2528 | 2528 |
| 2529 // static |
| 2530 void Browser::FindReplyHelper(TabContents* tab, |
| 2531 int request_id, |
| 2532 int number_of_matches, |
| 2533 const gfx::Rect& selection_rect, |
| 2534 int active_match_ordinal, |
| 2535 bool final_update) { |
| 2536 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
| 2537 tab); |
| 2538 if (!tcw || !tcw->find_tab_helper()) |
| 2539 return; |
| 2540 |
| 2541 tcw->find_tab_helper()->HandleFindReply(request_id, number_of_matches, |
| 2542 selection_rect, active_match_ordinal, |
| 2543 final_update); |
| 2544 } |
| 2545 |
2529 void Browser::ExecuteCommandWithDisposition( | 2546 void Browser::ExecuteCommandWithDisposition( |
2530 int id, WindowOpenDisposition disposition) { | 2547 int id, WindowOpenDisposition disposition) { |
2531 // No commands are enabled if there is not yet any selected tab. | 2548 // No commands are enabled if there is not yet any selected tab. |
2532 // TODO(pkasting): It seems like we should not need this, because either | 2549 // TODO(pkasting): It seems like we should not need this, because either |
2533 // most/all commands should not have been enabled yet anyway or the ones that | 2550 // most/all commands should not have been enabled yet anyway or the ones that |
2534 // are enabled should be global, or safe themselves against having no selected | 2551 // are enabled should be global, or safe themselves against having no selected |
2535 // tab. However, Ben says he tried removing this before and got lots of | 2552 // tab. However, Ben says he tried removing this before and got lots of |
2536 // crashes, e.g. from Windows sending WM_COMMANDs at random times during | 2553 // crashes, e.g. from Windows sending WM_COMMANDs at random times during |
2537 // window construction. This probably could use closer examination someday. | 2554 // window construction. This probably could use closer examination someday. |
2538 if (!GetSelectedTabContentsWrapper()) | 2555 if (!GetSelectedTabContentsWrapper()) |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3725 if (tab == GetSelectedTabContents()) | 3742 if (tab == GetSelectedTabContents()) |
3726 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); | 3743 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); |
3727 } | 3744 } |
3728 | 3745 |
3729 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { | 3746 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { |
3730 return GetJavaScriptDialogCreatorInstance(); | 3747 return GetJavaScriptDialogCreatorInstance(); |
3731 } | 3748 } |
3732 | 3749 |
3733 void Browser::RunFileChooser(TabContents* tab, | 3750 void Browser::RunFileChooser(TabContents* tab, |
3734 const ViewHostMsg_RunFileChooser_Params& params) { | 3751 const ViewHostMsg_RunFileChooser_Params& params) { |
3735 Browser::RunFileChooserHelper(tab, params); | 3752 RunFileChooserHelper(tab, params); |
3736 } | 3753 } |
3737 | 3754 |
3738 void Browser::EnumerateDirectory(TabContents* tab, int request_id, | 3755 void Browser::EnumerateDirectory(TabContents* tab, int request_id, |
3739 const FilePath& path) { | 3756 const FilePath& path) { |
3740 Browser::EnumerateDirectoryHelper(tab, request_id, path); | 3757 EnumerateDirectoryHelper(tab, request_id, path); |
3741 } | 3758 } |
3742 | 3759 |
3743 void Browser::ToggleFullscreenModeForTab(TabContents* tab, | 3760 void Browser::ToggleFullscreenModeForTab(TabContents* tab, |
3744 bool enter_fullscreen) { | 3761 bool enter_fullscreen) { |
3745 if (tab != GetSelectedTabContents()) | 3762 if (tab != GetSelectedTabContents()) |
3746 return; | 3763 return; |
3747 fullscreened_tab_ = enter_fullscreen ? | 3764 fullscreened_tab_ = enter_fullscreen ? |
3748 TabContentsWrapper::GetCurrentWrapperForContents(tab) : NULL; | 3765 TabContentsWrapper::GetCurrentWrapperForContents(tab) : NULL; |
3749 if (enter_fullscreen && !window_->IsFullscreen()) | 3766 if (enter_fullscreen && !window_->IsFullscreen()) |
3750 tab_caused_fullscreen_ = true; | 3767 tab_caused_fullscreen_ = true; |
3751 if (tab_caused_fullscreen_) | 3768 if (tab_caused_fullscreen_) |
3752 ToggleFullscreenMode(); | 3769 ToggleFullscreenMode(); |
3753 } | 3770 } |
3754 | 3771 |
3755 void Browser::JSOutOfMemory(TabContents* tab) { | 3772 void Browser::JSOutOfMemory(TabContents* tab) { |
3756 Browser::JSOutOfMemoryHelper(tab); | 3773 JSOutOfMemoryHelper(tab); |
3757 } | 3774 } |
3758 | 3775 |
3759 void Browser::RegisterProtocolHandler(TabContents* tab, | 3776 void Browser::RegisterProtocolHandler(TabContents* tab, |
3760 const std::string& protocol, | 3777 const std::string& protocol, |
3761 const GURL& url, | 3778 const GURL& url, |
3762 const string16& title) { | 3779 const string16& title) { |
3763 Browser::RegisterProtocolHandlerHelper(tab, protocol, url, title); | 3780 RegisterProtocolHandlerHelper(tab, protocol, url, title); |
3764 } | 3781 } |
3765 | 3782 |
3766 void Browser::RegisterIntentHandler(TabContents* tab, | 3783 void Browser::RegisterIntentHandler(TabContents* tab, |
3767 const string16& action, | 3784 const string16& action, |
3768 const string16& type, | 3785 const string16& type, |
3769 const string16& href, | 3786 const string16& href, |
3770 const string16& title) { | 3787 const string16& title) { |
3771 Browser::RegisterIntentHandlerHelper(tab, action, type, href, title); | 3788 RegisterIntentHandlerHelper(tab, action, type, href, title); |
3772 } | 3789 } |
3773 | 3790 |
3774 void Browser::WebIntentDispatch(TabContents* tab, | 3791 void Browser::WebIntentDispatch(TabContents* tab, |
3775 int routing_id, | 3792 int routing_id, |
3776 const string16& action, | 3793 const string16& action, |
3777 const string16& type, | 3794 const string16& type, |
3778 const string16& data, | 3795 const string16& data, |
3779 int intent_id) { | 3796 int intent_id) { |
3780 Browser::WebIntentDispatchHelper(tab, routing_id, action, type, data, | 3797 WebIntentDispatchHelper(tab, routing_id, action, type, data, |
3781 intent_id); | 3798 intent_id); |
| 3799 } |
| 3800 |
| 3801 void Browser::FindReply(TabContents* tab, |
| 3802 int request_id, |
| 3803 int number_of_matches, |
| 3804 const gfx::Rect& selection_rect, |
| 3805 int active_match_ordinal, |
| 3806 bool final_update) { |
| 3807 FindReplyHelper(tab, request_id, number_of_matches, selection_rect, |
| 3808 active_match_ordinal, final_update); |
3782 } | 3809 } |
3783 | 3810 |
3784 void Browser::ExitTabbedFullscreenModeIfNecessary() { | 3811 void Browser::ExitTabbedFullscreenModeIfNecessary() { |
3785 if (tab_caused_fullscreen_) | 3812 if (tab_caused_fullscreen_) |
3786 ToggleFullscreenMode(); | 3813 ToggleFullscreenMode(); |
3787 else | 3814 else |
3788 NotifyTabOfFullscreenExitIfNecessary(); | 3815 NotifyTabOfFullscreenExitIfNecessary(); |
3789 } | 3816 } |
3790 | 3817 |
3791 /////////////////////////////////////////////////////////////////////////////// | 3818 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5135 } | 5162 } |
5136 | 5163 |
5137 void Browser::ShowSyncSetup() { | 5164 void Browser::ShowSyncSetup() { |
5138 ProfileSyncService* service = | 5165 ProfileSyncService* service = |
5139 profile()->GetOriginalProfile()->GetProfileSyncService(); | 5166 profile()->GetOriginalProfile()->GetProfileSyncService(); |
5140 if (service->HasSyncSetupCompleted()) | 5167 if (service->HasSyncSetupCompleted()) |
5141 ShowOptionsTab(chrome::kSyncSetupSubPage); | 5168 ShowOptionsTab(chrome::kSyncSetupSubPage); |
5142 else | 5169 else |
5143 service->ShowLoginDialog(); | 5170 service->ShowLoginDialog(); |
5144 } | 5171 } |
OLD | NEW |