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 1921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1932 } | 1932 } |
1933 | 1933 |
1934 void Browser::FocusSearch() { | 1934 void Browser::FocusSearch() { |
1935 // TODO(beng): replace this with FocusLocationBar | 1935 // TODO(beng): replace this with FocusLocationBar |
1936 UserMetrics::RecordAction(UserMetricsAction("FocusSearch")); | 1936 UserMetrics::RecordAction(UserMetricsAction("FocusSearch")); |
1937 window_->GetLocationBar()->FocusSearch(); | 1937 window_->GetLocationBar()->FocusSearch(); |
1938 } | 1938 } |
1939 | 1939 |
1940 void Browser::OpenFile() { | 1940 void Browser::OpenFile() { |
1941 UserMetrics::RecordAction(UserMetricsAction("OpenFile")); | 1941 UserMetrics::RecordAction(UserMetricsAction("OpenFile")); |
1942 #if defined(OS_CHROMEOS) && !defined(FILE_MANAGER_EXTENSION) | |
1943 FileBrowseUI::OpenPopup(profile_, | |
1944 "", | |
1945 FileBrowseUI::kPopupWidth, | |
1946 FileBrowseUI::kPopupHeight); | |
1947 #else | |
1948 if (!select_file_dialog_.get()) | 1942 if (!select_file_dialog_.get()) |
1949 select_file_dialog_ = SelectFileDialog::Create(this); | 1943 select_file_dialog_ = SelectFileDialog::Create(this); |
1950 | 1944 |
1951 const FilePath directory = profile_->last_selected_directory(); | 1945 const FilePath directory = profile_->last_selected_directory(); |
1952 | 1946 |
1953 // TODO(beng): figure out how to juggle this. | 1947 // TODO(beng): figure out how to juggle this. |
1954 gfx::NativeWindow parent_window = window_->GetNativeHandle(); | 1948 gfx::NativeWindow parent_window = window_->GetNativeHandle(); |
1955 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 1949 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, |
1956 string16(), directory, | 1950 string16(), directory, |
1957 NULL, 0, FILE_PATH_LITERAL(""), | 1951 NULL, 0, FILE_PATH_LITERAL(""), |
1958 GetSelectedTabContents(), | 1952 GetSelectedTabContents(), |
1959 parent_window, NULL); | 1953 parent_window, NULL); |
1960 #endif | |
1961 } | 1954 } |
1962 | 1955 |
1963 void Browser::OpenCreateShortcutsDialog() { | 1956 void Browser::OpenCreateShortcutsDialog() { |
1964 UserMetrics::RecordAction(UserMetricsAction("CreateShortcut")); | 1957 UserMetrics::RecordAction(UserMetricsAction("CreateShortcut")); |
1965 #if !defined(OS_MACOSX) | 1958 #if !defined(OS_MACOSX) |
1966 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); | 1959 TabContentsWrapper* current_tab = GetSelectedTabContentsWrapper(); |
1967 DCHECK(current_tab && | 1960 DCHECK(current_tab && |
1968 web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << | 1961 web_app::IsValidUrl(current_tab->tab_contents()->GetURL())) << |
1969 "Menu item should be disabled."; | 1962 "Menu item should be disabled."; |
1970 | 1963 |
(...skipping 1690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3661 // Download in a constrained popup is shown in the tab that opened it. | 3654 // Download in a constrained popup is shown in the tab that opened it. |
3662 TabContents* constrained_tab = constrained->tab_contents(); | 3655 TabContents* constrained_tab = constrained->tab_contents(); |
3663 constrained_tab->delegate()->OnStartDownload(constrained_tab, download); | 3656 constrained_tab->delegate()->OnStartDownload(constrained_tab, download); |
3664 return; | 3657 return; |
3665 } | 3658 } |
3666 | 3659 |
3667 if (!window()) | 3660 if (!window()) |
3668 return; | 3661 return; |
3669 | 3662 |
3670 if (DisplayOldDownloadsUI()) { | 3663 if (DisplayOldDownloadsUI()) { |
3671 #if defined(OS_CHROMEOS) | 3664 #if defined(USE_AURA) |
| 3665 // TODO(saintlou): There is no implementation for Aura. |
| 3666 #elif defined(OS_CHROMEOS) |
3672 // Don't show content browser for extension/theme downloads from gallery. | 3667 // Don't show content browser for extension/theme downloads from gallery. |
3673 ExtensionService* service = profile_->GetExtensionService(); | 3668 ExtensionService* service = profile_->GetExtensionService(); |
3674 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || | 3669 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || |
3675 (service == NULL) || | 3670 (service == NULL) || |
3676 !service->IsDownloadFromGallery(download->GetURL(), | 3671 !service->IsDownloadFromGallery(download->GetURL(), |
3677 download->referrer_url())) { | 3672 download->referrer_url())) { |
3678 // Open the Active Downloads ui for chromeos. | 3673 // Open the Active Downloads ui for chromeos. |
3679 ActiveDownloadsUI::OpenPopup(profile_); | 3674 ActiveDownloadsUI::OpenPopup(profile_); |
3680 } | 3675 } |
3681 #else | 3676 #else |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5238 profile()->GetOriginalProfile()->GetProfileSyncService(); | 5233 profile()->GetOriginalProfile()->GetProfileSyncService(); |
5239 if (service->HasSyncSetupCompleted()) | 5234 if (service->HasSyncSetupCompleted()) |
5240 ShowOptionsTab(chrome::kSyncSetupSubPage); | 5235 ShowOptionsTab(chrome::kSyncSetupSubPage); |
5241 else | 5236 else |
5242 service->ShowLoginDialog(); | 5237 service->ShowLoginDialog(); |
5243 } | 5238 } |
5244 | 5239 |
5245 void Browser::ToggleSpeechInput() { | 5240 void Browser::ToggleSpeechInput() { |
5246 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); | 5241 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); |
5247 } | 5242 } |
OLD | NEW |