| 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 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 int Browser::GetIndexForInsertionDuringRestore(int relative_index) { | 1109 int Browser::GetIndexForInsertionDuringRestore(int relative_index) { |
| 1110 return (tab_handler_->GetTabStripModel()->insertion_policy() == | 1110 return (tab_handler_->GetTabStripModel()->insertion_policy() == |
| 1111 TabStripModel::INSERT_AFTER) ? tab_count() : relative_index; | 1111 TabStripModel::INSERT_AFTER) ? tab_count() : relative_index; |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 TabContentsWrapper* Browser::AddSelectedTabWithURL(const GURL& url, | 1114 TabContentsWrapper* Browser::AddSelectedTabWithURL(const GURL& url, |
| 1115 PageTransition::Type transition) { | 1115 PageTransition::Type transition) { |
| 1116 browser::NavigateParams params(this, url, transition); | 1116 browser::NavigateParams params(this, url, transition); |
| 1117 params.disposition = NEW_FOREGROUND_TAB; | 1117 params.disposition = NEW_FOREGROUND_TAB; |
| 1118 browser::Navigate(¶ms); | 1118 browser::Navigate(¶ms); |
| 1119 return params.target_contents; | 1119 TabContentsWrapper* target_contents_wrapper = params.target_contents; |
| 1120 NotificationService::current()->Notify( |
| 1121 content::NOTIFICATION_TAB_ADDED, |
| 1122 Source<TabContentsDelegate>(params.browser), |
| 1123 Details<TabContents>(target_contents_wrapper->tab_contents())); |
| 1124 return target_contents_wrapper; |
| 1120 } | 1125 } |
| 1121 | 1126 |
| 1122 TabContents* Browser::AddTab(TabContentsWrapper* tab_contents, | 1127 TabContents* Browser::AddTab(TabContentsWrapper* tab_contents, |
| 1123 PageTransition::Type type) { | 1128 PageTransition::Type type) { |
| 1124 tab_handler_->GetTabStripModel()->AddTabContents( | 1129 tab_handler_->GetTabStripModel()->AddTabContents( |
| 1125 tab_contents, -1, type, TabStripModel::ADD_ACTIVE); | 1130 tab_contents, -1, type, TabStripModel::ADD_ACTIVE); |
| 1126 return tab_contents->tab_contents(); | 1131 return tab_contents->tab_contents(); |
| 1127 } | 1132 } |
| 1128 | 1133 |
| 1129 void Browser::AddTabContents(TabContents* new_contents, | 1134 void Browser::AddTabContents(TabContents* new_contents, |
| (...skipping 2383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3513 | 3518 |
| 3514 void Browser::DidNavigateToPendingEntry(TabContents* tab) { | 3519 void Browser::DidNavigateToPendingEntry(TabContents* tab) { |
| 3515 if (tab == GetSelectedTabContents()) | 3520 if (tab == GetSelectedTabContents()) |
| 3516 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); | 3521 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); |
| 3517 } | 3522 } |
| 3518 | 3523 |
| 3519 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { | 3524 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { |
| 3520 return GetJavaScriptDialogCreatorInstance(); | 3525 return GetJavaScriptDialogCreatorInstance(); |
| 3521 } | 3526 } |
| 3522 | 3527 |
| 3528 void Browser::UpdatePreferredSize(const gfx::Size& pref_size) { |
| 3529 window_->UpdatePreferredSize(pref_size); |
| 3530 } |
| 3531 |
| 3523 /////////////////////////////////////////////////////////////////////////////// | 3532 /////////////////////////////////////////////////////////////////////////////// |
| 3524 // Browser, TabContentsWrapperDelegate implementation: | 3533 // Browser, TabContentsWrapperDelegate implementation: |
| 3525 | 3534 |
| 3526 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, | 3535 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, |
| 3527 int32 page_id) { | 3536 int32 page_id) { |
| 3528 if (GetSelectedTabContentsWrapper() != source) | 3537 if (GetSelectedTabContentsWrapper() != source) |
| 3529 return; | 3538 return; |
| 3530 | 3539 |
| 3531 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); | 3540 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); |
| 3532 if (!entry || (entry->page_id() != page_id)) | 3541 if (!entry || (entry->page_id() != page_id)) |
| (...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4852 } | 4861 } |
| 4853 | 4862 |
| 4854 void Browser::ShowSyncSetup() { | 4863 void Browser::ShowSyncSetup() { |
| 4855 ProfileSyncService* service = | 4864 ProfileSyncService* service = |
| 4856 profile()->GetOriginalProfile()->GetProfileSyncService(); | 4865 profile()->GetOriginalProfile()->GetProfileSyncService(); |
| 4857 if (service->HasSyncSetupCompleted()) | 4866 if (service->HasSyncSetupCompleted()) |
| 4858 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4867 ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 4859 else | 4868 else |
| 4860 service->ShowLoginDialog(); | 4869 service->ShowLoginDialog(); |
| 4861 } | 4870 } |
| OLD | NEW |