| 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 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 } | 1938 } |
| 1939 | 1939 |
| 1940 void Browser::FocusSearch() { | 1940 void Browser::FocusSearch() { |
| 1941 // TODO(beng): replace this with FocusLocationBar | 1941 // TODO(beng): replace this with FocusLocationBar |
| 1942 UserMetrics::RecordAction(UserMetricsAction("FocusSearch")); | 1942 UserMetrics::RecordAction(UserMetricsAction("FocusSearch")); |
| 1943 window_->GetLocationBar()->FocusSearch(); | 1943 window_->GetLocationBar()->FocusSearch(); |
| 1944 } | 1944 } |
| 1945 | 1945 |
| 1946 void Browser::OpenFile() { | 1946 void Browser::OpenFile() { |
| 1947 UserMetrics::RecordAction(UserMetricsAction("OpenFile")); | 1947 UserMetrics::RecordAction(UserMetricsAction("OpenFile")); |
| 1948 #if defined(OS_CHROMEOS) && !defined(FILE_MANAGER_EXTENSION) | |
| 1949 FileBrowseUI::OpenPopup(profile_, | |
| 1950 "", | |
| 1951 FileBrowseUI::kPopupWidth, | |
| 1952 FileBrowseUI::kPopupHeight); | |
| 1953 #else | |
| 1954 if (!select_file_dialog_.get()) | 1948 if (!select_file_dialog_.get()) |
| 1955 select_file_dialog_ = SelectFileDialog::Create(this); | 1949 select_file_dialog_ = SelectFileDialog::Create(this); |
| 1956 | 1950 |
| 1957 const FilePath directory = profile_->last_selected_directory(); | 1951 const FilePath directory = profile_->last_selected_directory(); |
| 1958 | 1952 |
| 1959 // TODO(beng): figure out how to juggle this. | 1953 // TODO(beng): figure out how to juggle this. |
| 1960 gfx::NativeWindow parent_window = window_->GetNativeHandle(); | 1954 gfx::NativeWindow parent_window = window_->GetNativeHandle(); |
| 1961 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 1955 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, |
| 1962 string16(), directory, | 1956 string16(), directory, |
| 1963 NULL, 0, FILE_PATH_LITERAL(""), | 1957 NULL, 0, FILE_PATH_LITERAL(""), |
| 1964 GetSelectedTabContents(), | 1958 GetSelectedTabContents(), |
| 1965 parent_window, NULL); | 1959 parent_window, NULL); |
| 1966 #endif | |
| 1967 } | 1960 } |
| 1968 | 1961 |
| 1969 void Browser::OpenCreateShortcutsDialog() { | 1962 void Browser::OpenCreateShortcutsDialog() { |
| 1970 UserMetrics::RecordAction(UserMetricsAction("CreateShortcut")); | 1963 UserMetrics::RecordAction(UserMetricsAction("CreateShortcut")); |
| 1971 #if !defined(OS_MACOSX) | 1964 #if !defined(OS_MACOSX) |
| 1972 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); | 1965 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); |
| 1973 DCHECK(current_tab && | 1966 DCHECK(current_tab && |
| 1974 web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << | 1967 web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << |
| 1975 "Menu item should be disabled."; | 1968 "Menu item should be disabled."; |
| 1976 | 1969 |
| (...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3667 // Download in a constrained popup is shown in the tab that opened it. | 3660 // Download in a constrained popup is shown in the tab that opened it. |
| 3668 TabContents* constrained_tab = constrained->tab_contents(); | 3661 TabContents* constrained_tab = constrained->tab_contents(); |
| 3669 constrained_tab->delegate()->OnStartDownload(constrained_tab, download); | 3662 constrained_tab->delegate()->OnStartDownload(constrained_tab, download); |
| 3670 return; | 3663 return; |
| 3671 } | 3664 } |
| 3672 | 3665 |
| 3673 if (!window()) | 3666 if (!window()) |
| 3674 return; | 3667 return; |
| 3675 | 3668 |
| 3676 if (DisplayOldDownloadsUI()) { | 3669 if (DisplayOldDownloadsUI()) { |
| 3677 #if defined(OS_CHROMEOS) | 3670 #if defined(USE_AURA) |
| 3671 // TODO(saintlou): There is no implementation for Aura. |
| 3672 #elif defined(OS_CHROMEOS) |
| 3678 // Don't show content browser for extension/theme downloads from gallery. | 3673 // Don't show content browser for extension/theme downloads from gallery. |
| 3679 ExtensionService* service = profile_->GetExtensionService(); | 3674 ExtensionService* service = profile_->GetExtensionService(); |
| 3680 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || | 3675 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || |
| 3681 (service == NULL) || | 3676 (service == NULL) || |
| 3682 !service->IsDownloadFromGallery(download->GetURL(), | 3677 !service->IsDownloadFromGallery(download->GetURL(), |
| 3683 download->referrer_url())) { | 3678 download->referrer_url())) { |
| 3684 // Open the Active Downloads ui for chromeos. | 3679 // Open the Active Downloads ui for chromeos. |
| 3685 ActiveDownloadsUI::OpenPopup(profile_); | 3680 ActiveDownloadsUI::OpenPopup(profile_); |
| 3686 } | 3681 } |
| 3687 #else | 3682 #else |
| (...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5255 profile()->GetOriginalProfile()->GetProfileSyncService(); | 5250 profile()->GetOriginalProfile()->GetProfileSyncService(); |
| 5256 if (service->HasSyncSetupCompleted()) | 5251 if (service->HasSyncSetupCompleted()) |
| 5257 ShowOptionsTab(chrome::kSyncSetupSubPage); | 5252 ShowOptionsTab(chrome::kSyncSetupSubPage); |
| 5258 else | 5253 else |
| 5259 service->ShowLoginDialog(); | 5254 service->ShowLoginDialog(); |
| 5260 } | 5255 } |
| 5261 | 5256 |
| 5262 void Browser::ToggleSpeechInput() { | 5257 void Browser::ToggleSpeechInput() { |
| 5263 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); | 5258 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); |
| 5264 } | 5259 } |
| OLD | NEW |