Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: chrome/browser/browser.cc

Issue 459008: Mac: the return of the tab-modal-sheets patch. (Closed)
Patch Set: Merged ToT. Must ... commit ... soon. Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/cocoa/constrained_window_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser.h" 5 #include "chrome/browser/browser.h"
6 6
7 #include "app/animation.h" 7 #include "app/animation.h"
8 #include "app/l10n_util.h" 8 #include "app/l10n_util.h"
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 } 1156 }
1157 1157
1158 void Browser::FocusSearch() { 1158 void Browser::FocusSearch() {
1159 // TODO(beng): replace this with FocusLocationBar 1159 // TODO(beng): replace this with FocusLocationBar
1160 UserMetrics::RecordAction("FocusSearch", profile_); 1160 UserMetrics::RecordAction("FocusSearch", profile_);
1161 window_->GetLocationBar()->FocusSearch(); 1161 window_->GetLocationBar()->FocusSearch();
1162 } 1162 }
1163 1163
1164 void Browser::OpenFile() { 1164 void Browser::OpenFile() {
1165 UserMetrics::RecordAction("OpenFile", profile_); 1165 UserMetrics::RecordAction("OpenFile", profile_);
1166
1167 TabContents* contents = GetSelectedTabContents();
1168 if (!contents) { // Avoid crashing in release.
1169 NOTREACHED();
1170 return;
1171 }
1172
1173 // TODO(beng): figure out how to juggle this.
1174 #if defined(OS_MACOSX)
1175 // TODO(viettrungluu): If there's a constrained dialog in the current tab, we
1176 // should probably just create a new tab and go do the open there. (Why not
1177 // just close the current dialog, esp. if it's not important? If we did that,
1178 // then the previous one should come back with its original state on cancel.)
1179 if (!contents->CanCreateConstrainedDialog()) {
1180 if (type() == TYPE_NORMAL) {
1181 contents = AddBlankTab(true);
1182 if (!contents) { // Avoid crashing in release.
1183 NOTREACHED();
1184 return;
1185 }
1186 } else {
1187 // TODO(viettrungluu): the other cases.
1188 NOTIMPLEMENTED();
1189 return;
1190 }
1191 }
1192
1193 if (!contents->CanCreateConstrainedDialog()) { // Avoid crashing in release.
1194 NOTREACHED();
1195 return;
1196 }
1197
1166 if (!select_file_dialog_.get()) 1198 if (!select_file_dialog_.get())
1167 select_file_dialog_ = SelectFileDialog::Create(this); 1199 select_file_dialog_ = SelectFileDialog::Create(this);
1168 1200 select_file_dialog_->SelectFileInTab(SelectFileDialog::SELECT_OPEN_FILE,
1169 // TODO(beng): figure out how to juggle this. 1201 string16(), FilePath(),
1202 NULL, 0, FILE_PATH_LITERAL(""),
1203 contents, NULL);
1204 #else
1205 if (!select_file_dialog_.get())
1206 select_file_dialog_ = SelectFileDialog::Create(this);
1170 gfx::NativeWindow parent_window = window_->GetNativeHandle(); 1207 gfx::NativeWindow parent_window = window_->GetNativeHandle();
1171 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, 1208 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE,
1172 string16(), FilePath(), 1209 string16(), FilePath(),
1173 NULL, 0, FILE_PATH_LITERAL(""), 1210 NULL, 0, FILE_PATH_LITERAL(""),
1174 parent_window, NULL); 1211 parent_window, NULL);
1212 #endif
1175 } 1213 }
1176 1214
1177 void Browser::OpenCreateShortcutsDialog() { 1215 void Browser::OpenCreateShortcutsDialog() {
1178 UserMetrics::RecordAction("CreateShortcut", profile_); 1216 UserMetrics::RecordAction("CreateShortcut", profile_);
1179 #if defined(OS_WIN) || defined(OS_LINUX) 1217 #if defined(OS_WIN) || defined(OS_LINUX)
1180 TabContents* current_tab = GetSelectedTabContents(); 1218 TabContents* current_tab = GetSelectedTabContents();
1181 DCHECK(current_tab && web_app::IsValidUrl(current_tab->GetURL())) << 1219 DCHECK(current_tab && web_app::IsValidUrl(current_tab->GetURL())) <<
1182 "Menu item should be disabled."; 1220 "Menu item should be disabled.";
1183 1221
1184 NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry(); 1222 NavigationEntry* entry = current_tab->controller().GetLastCommittedEntry();
(...skipping 1963 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 /////////////////////////////////////////////////////////////////////////////// 3186 ///////////////////////////////////////////////////////////////////////////////
3149 // BrowserToolbarModel (private): 3187 // BrowserToolbarModel (private):
3150 3188
3151 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() { 3189 NavigationController* Browser::BrowserToolbarModel::GetNavigationController() {
3152 // This |current_tab| can be NULL during the initialization of the 3190 // This |current_tab| can be NULL during the initialization of the
3153 // toolbar during window creation (i.e. before any tabs have been added 3191 // toolbar during window creation (i.e. before any tabs have been added
3154 // to the window). 3192 // to the window).
3155 TabContents* current_tab = browser_->GetSelectedTabContents(); 3193 TabContents* current_tab = browser_->GetSelectedTabContents();
3156 return current_tab ? &current_tab->controller() : NULL; 3194 return current_tab ? &current_tab->controller() : NULL;
3157 } 3195 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/constrained_window_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698