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 | |
Emmanuel Saint-loubert-Bié
2011/09/15 02:10:25
The code above was never compiled, if it did then
| |
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 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3671 #if defined(OS_CHROMEOS) | 3664 #if defined(OS_CHROMEOS) |
3672 // Don't show content browser for extension/theme downloads from gallery. | 3665 // Don't show content browser for extension/theme downloads from gallery. |
3673 ExtensionService* service = profile_->GetExtensionService(); | 3666 ExtensionService* service = profile_->GetExtensionService(); |
3674 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || | 3667 if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || |
3675 (service == NULL) || | 3668 (service == NULL) || |
3676 !service->IsDownloadFromGallery(download->GetURL(), | 3669 !service->IsDownloadFromGallery(download->GetURL(), |
3677 download->referrer_url())) { | 3670 download->referrer_url())) { |
3678 // Open the Active Downloads ui for chromeos. | 3671 // Open the Active Downloads ui for chromeos. |
3679 ActiveDownloadsUI::OpenPopup(profile_); | 3672 ActiveDownloadsUI::OpenPopup(profile_); |
3680 } | 3673 } |
3681 #else | 3674 #elif !defined(USE_AURA) |
3682 // GetDownloadShelf creates the download shelf if it was not yet created. | 3675 // GetDownloadShelf creates the download shelf if it was not yet created. |
3683 DownloadShelf* shelf = window()->GetDownloadShelf(); | 3676 DownloadShelf* shelf = window()->GetDownloadShelf(); |
3684 shelf->AddDownload(new DownloadItemModel(download)); | 3677 shelf->AddDownload(new DownloadItemModel(download)); |
3685 // Don't show the animation for "Save file" downloads. | 3678 // Don't show the animation for "Save file" downloads. |
3686 // For non-theme extensions, we don't show the download animation. | 3679 // For non-theme extensions, we don't show the download animation. |
3687 // Show animation in same window as the download shelf. Download shelf | 3680 // Show animation in same window as the download shelf. Download shelf |
3688 // may not be in the same window that initiated the download, e.g. | 3681 // may not be in the same window that initiated the download, e.g. |
3689 // Panels. | 3682 // Panels. |
3690 // Don't show the animation if the selected tab is not visible (i.e. the | 3683 // Don't show the animation if the selected tab is not visible (i.e. the |
3691 // window is minimized, we're in a unit test, etc.). | 3684 // window is minimized, we're in a unit test, etc.). |
3692 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); | 3685 TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); |
3693 if ((download->total_bytes() > 0) && | 3686 if ((download->total_bytes() > 0) && |
3694 (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || | 3687 (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || |
3695 ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) && | 3688 ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) && |
3696 platform_util::IsVisible(shelf_tab->GetNativeView()) && | 3689 platform_util::IsVisible(shelf_tab->GetNativeView()) && |
3697 ui::Animation::ShouldRenderRichAnimation()) { | 3690 ui::Animation::ShouldRenderRichAnimation()) { |
3691 // TODO(saintlou): There is no implementation for Aura. | |
3698 DownloadStartedAnimation::Show(shelf_tab); | 3692 DownloadStartedAnimation::Show(shelf_tab); |
3699 } | 3693 } |
3700 #endif | 3694 #endif |
3701 } | 3695 } |
3702 | 3696 |
3703 // If the download occurs in a new tab, close it. | 3697 // If the download occurs in a new tab, close it. |
3704 if (source->controller().IsInitialNavigation() && tab_count() > 1) | 3698 if (source->controller().IsInitialNavigation() && tab_count() > 1) |
3705 CloseContents(source); | 3699 CloseContents(source); |
3706 } | 3700 } |
3707 | 3701 |
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5238 profile()->GetOriginalProfile()->GetProfileSyncService(); | 5232 profile()->GetOriginalProfile()->GetProfileSyncService(); |
5239 if (service->HasSyncSetupCompleted()) | 5233 if (service->HasSyncSetupCompleted()) |
5240 ShowOptionsTab(chrome::kSyncSetupSubPage); | 5234 ShowOptionsTab(chrome::kSyncSetupSubPage); |
5241 else | 5235 else |
5242 service->ShowLoginDialog(); | 5236 service->ShowLoginDialog(); |
5243 } | 5237 } |
5244 | 5238 |
5245 void Browser::ToggleSpeechInput() { | 5239 void Browser::ToggleSpeechInput() { |
5246 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); | 5240 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); |
5247 } | 5241 } |
OLD | NEW |