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 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 int Browser::GetIndexForInsertionDuringRestore(int relative_index) { | 1107 int Browser::GetIndexForInsertionDuringRestore(int relative_index) { |
1108 return (tab_handler_->GetTabStripModel()->insertion_policy() == | 1108 return (tab_handler_->GetTabStripModel()->insertion_policy() == |
1109 TabStripModel::INSERT_AFTER) ? tab_count() : relative_index; | 1109 TabStripModel::INSERT_AFTER) ? tab_count() : relative_index; |
1110 } | 1110 } |
1111 | 1111 |
1112 TabContentsWrapper* Browser::AddSelectedTabWithURL(const GURL& url, | 1112 TabContentsWrapper* Browser::AddSelectedTabWithURL(const GURL& url, |
1113 PageTransition::Type transition) { | 1113 PageTransition::Type transition) { |
1114 browser::NavigateParams params(this, url, transition); | 1114 browser::NavigateParams params(this, url, transition); |
1115 params.disposition = NEW_FOREGROUND_TAB; | 1115 params.disposition = NEW_FOREGROUND_TAB; |
1116 browser::Navigate(¶ms); | 1116 browser::Navigate(¶ms); |
1117 return params.target_contents; | 1117 TabContentsWrapper* target_contents_wrapper = params.target_contents; |
| 1118 NotificationService::current()->Notify( |
| 1119 content::NOTIFICATION_TAB_ADDED, |
| 1120 Source<TabContentsDelegate>(params.browser), |
| 1121 Details<TabContents>(target_contents_wrapper->tab_contents())); |
| 1122 return target_contents_wrapper; |
1118 } | 1123 } |
1119 | 1124 |
1120 TabContents* Browser::AddTab(TabContentsWrapper* tab_contents, | 1125 TabContents* Browser::AddTab(TabContentsWrapper* tab_contents, |
1121 PageTransition::Type type) { | 1126 PageTransition::Type type) { |
1122 tab_handler_->GetTabStripModel()->AddTabContents( | 1127 tab_handler_->GetTabStripModel()->AddTabContents( |
1123 tab_contents, -1, type, TabStripModel::ADD_ACTIVE); | 1128 tab_contents, -1, type, TabStripModel::ADD_ACTIVE); |
1124 return tab_contents->tab_contents(); | 1129 return tab_contents->tab_contents(); |
1125 } | 1130 } |
1126 | 1131 |
1127 void Browser::AddTabContents(TabContents* new_contents, | 1132 void Browser::AddTabContents(TabContents* new_contents, |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 | 3493 |
3489 void Browser::DidNavigateToPendingEntry(TabContents* tab) { | 3494 void Browser::DidNavigateToPendingEntry(TabContents* tab) { |
3490 if (tab == GetSelectedTabContents()) | 3495 if (tab == GetSelectedTabContents()) |
3491 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); | 3496 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); |
3492 } | 3497 } |
3493 | 3498 |
3494 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { | 3499 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { |
3495 return GetJavaScriptDialogCreatorInstance(); | 3500 return GetJavaScriptDialogCreatorInstance(); |
3496 } | 3501 } |
3497 | 3502 |
| 3503 void Browser::UpdatePreferredSize(const gfx::Size& pref_size) { |
| 3504 window_->UpdatePreferredSize(pref_size); |
| 3505 } |
| 3506 |
3498 /////////////////////////////////////////////////////////////////////////////// | 3507 /////////////////////////////////////////////////////////////////////////////// |
3499 // Browser, TabContentsWrapperDelegate implementation: | 3508 // Browser, TabContentsWrapperDelegate implementation: |
3500 | 3509 |
3501 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, | 3510 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, |
3502 int32 page_id) { | 3511 int32 page_id) { |
3503 if (GetSelectedTabContentsWrapper() != source) | 3512 if (GetSelectedTabContentsWrapper() != source) |
3504 return; | 3513 return; |
3505 | 3514 |
3506 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); | 3515 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); |
3507 if (!entry || (entry->page_id() != page_id)) | 3516 if (!entry || (entry->page_id() != page_id)) |
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4797 window_->BookmarkBarStateChanged(animate_type); | 4806 window_->BookmarkBarStateChanged(animate_type); |
4798 } | 4807 } |
4799 | 4808 |
4800 void Browser::ShowSyncSetup() { | 4809 void Browser::ShowSyncSetup() { |
4801 ProfileSyncService* service = profile()->GetProfileSyncService(); | 4810 ProfileSyncService* service = profile()->GetProfileSyncService(); |
4802 if (service->HasSyncSetupCompleted()) | 4811 if (service->HasSyncSetupCompleted()) |
4803 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4812 ShowOptionsTab(chrome::kSyncSetupSubPage); |
4804 else | 4813 else |
4805 profile()->GetProfileSyncService()->ShowLoginDialog(); | 4814 profile()->GetProfileSyncService()->ShowLoginDialog(); |
4806 } | 4815 } |
OLD | NEW |