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

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

Issue 1363093004: Add BrowserSelectFileDialogTest.OpenCloseFileDialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move the comment into the body of the function. Created 5 years, 2 months 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 std::string new_selected_encoding_list; 879 std::string new_selected_encoding_list;
880 if (CharacterEncoding::UpdateRecentlySelectedEncoding( 880 if (CharacterEncoding::UpdateRecentlySelectedEncoding(
881 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), 881 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding),
882 encoding_id, 882 encoding_id,
883 &new_selected_encoding_list)) { 883 &new_selected_encoding_list)) {
884 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, 884 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding,
885 new_selected_encoding_list); 885 new_selected_encoding_list);
886 } 886 }
887 } 887 }
888 888
889 void Browser::OpenFile() { 889 ui::SelectFileDialog* Browser::OpenFile() {
890 content::RecordAction(UserMetricsAction("OpenFile")); 890 content::RecordAction(UserMetricsAction("OpenFile"));
891 select_file_dialog_ = ui::SelectFileDialog::Create( 891 select_file_dialog_ = ui::SelectFileDialog::Create(
892 this, new ChromeSelectFilePolicy( 892 this, new ChromeSelectFilePolicy(
893 tab_strip_model_->GetActiveWebContents())); 893 tab_strip_model_->GetActiveWebContents()));
894 894
895 const base::FilePath directory = profile_->last_selected_directory(); 895 const base::FilePath directory = profile_->last_selected_directory();
896 896
897 // TODO(beng): figure out how to juggle this. 897 // TODO(beng): figure out how to juggle this.
898 gfx::NativeWindow parent_window = window_->GetNativeWindow(); 898 gfx::NativeWindow parent_window = window_->GetNativeWindow();
899 ui::SelectFileDialog::FileTypeInfo file_types; 899 ui::SelectFileDialog::FileTypeInfo file_types;
900 file_types.support_drive = true; 900 file_types.support_drive = true;
901 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE, 901 select_file_dialog_->SelectFile(ui::SelectFileDialog::SELECT_OPEN_FILE,
902 base::string16(), 902 base::string16(),
903 directory, 903 directory,
904 &file_types, 904 &file_types,
905 0, 905 0,
906 base::FilePath::StringType(), 906 base::FilePath::StringType(),
907 parent_window, 907 parent_window,
908 NULL); 908 NULL);
909 return select_file_dialog_.get();
909 } 910 }
910 911
911 void Browser::UpdateDownloadShelfVisibility(bool visible) { 912 void Browser::UpdateDownloadShelfVisibility(bool visible) {
912 if (GetStatusBubble()) 913 if (GetStatusBubble())
913 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); 914 GetStatusBubble()->UpdateDownloadShelfVisibility(visible);
914 } 915 }
915 916
916 /////////////////////////////////////////////////////////////////////////////// 917 ///////////////////////////////////////////////////////////////////////////////
917 918
918 void Browser::UpdateUIForNavigationInTab(WebContents* contents, 919 void Browser::UpdateUIForNavigationInTab(WebContents* contents,
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
2699 if (contents && !allow_js_access) { 2700 if (contents && !allow_js_access) {
2700 contents->web_contents()->GetController().LoadURL( 2701 contents->web_contents()->GetController().LoadURL(
2701 target_url, 2702 target_url,
2702 content::Referrer(), 2703 content::Referrer(),
2703 ui::PAGE_TRANSITION_LINK, 2704 ui::PAGE_TRANSITION_LINK,
2704 std::string()); // No extra headers. 2705 std::string()); // No extra headers.
2705 } 2706 }
2706 2707
2707 return contents != NULL; 2708 return contents != NULL;
2708 } 2709 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698