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( | |
Peter Kasting
2011/08/12 17:19:45
Is this necessary? It seems like this ought to be
jianli
2011/08/16 20:55:57
Changed to call Notify from Navigate(), as suggest
| |
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 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3501 | 3506 |
3502 void Browser::DidNavigateToPendingEntry(TabContents* tab) { | 3507 void Browser::DidNavigateToPendingEntry(TabContents* tab) { |
3503 if (tab == GetSelectedTabContents()) | 3508 if (tab == GetSelectedTabContents()) |
3504 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); | 3509 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); |
3505 } | 3510 } |
3506 | 3511 |
3507 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { | 3512 content::JavaScriptDialogCreator* Browser::GetJavaScriptDialogCreator() { |
3508 return GetJavaScriptDialogCreatorInstance(); | 3513 return GetJavaScriptDialogCreatorInstance(); |
3509 } | 3514 } |
3510 | 3515 |
3516 void Browser::UpdatePreferredSize(TabContents* source, | |
3517 const gfx::Size& pref_size) { | |
3518 window_->UpdatePreferredSize(source, pref_size); | |
3519 } | |
3520 | |
3511 /////////////////////////////////////////////////////////////////////////////// | 3521 /////////////////////////////////////////////////////////////////////////////// |
3512 // Browser, TabContentsWrapperDelegate implementation: | 3522 // Browser, TabContentsWrapperDelegate implementation: |
3513 | 3523 |
3514 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, | 3524 void Browser::OnDidGetApplicationInfo(TabContentsWrapper* source, |
3515 int32 page_id) { | 3525 int32 page_id) { |
3516 if (GetSelectedTabContentsWrapper() != source) | 3526 if (GetSelectedTabContentsWrapper() != source) |
3517 return; | 3527 return; |
3518 | 3528 |
3519 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); | 3529 NavigationEntry* entry = source->controller().GetLastCommittedEntry(); |
3520 if (!entry || (entry->page_id() != page_id)) | 3530 if (!entry || (entry->page_id() != page_id)) |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4840 } | 4850 } |
4841 | 4851 |
4842 void Browser::ShowSyncSetup() { | 4852 void Browser::ShowSyncSetup() { |
4843 ProfileSyncService* service = | 4853 ProfileSyncService* service = |
4844 profile()->GetOriginalProfile()->GetProfileSyncService(); | 4854 profile()->GetOriginalProfile()->GetProfileSyncService(); |
4845 if (service->HasSyncSetupCompleted()) | 4855 if (service->HasSyncSetupCompleted()) |
4846 ShowOptionsTab(chrome::kSyncSetupSubPage); | 4856 ShowOptionsTab(chrome::kSyncSetupSubPage); |
4847 else | 4857 else |
4848 service->ShowLoginDialog(); | 4858 service->ShowLoginDialog(); |
4849 } | 4859 } |
OLD | NEW |