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

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

Issue 2450004: Don't save last used locations in open and save dialogs when in incognito mode. (Closed) Base URL: git://codf21.jail.google.com/chromium.git
Patch Set: Rename kLastSelectedDirectory to kSelectFileLastDirectory. Created 10 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/download/save_package.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 UserMetrics::RecordAction(UserMetricsAction("OpenFile"), profile_); 1571 UserMetrics::RecordAction(UserMetricsAction("OpenFile"), profile_);
1572 #if defined(OS_CHROMEOS) 1572 #if defined(OS_CHROMEOS)
1573 FileBrowseUI::OpenPopup(profile_, 1573 FileBrowseUI::OpenPopup(profile_,
1574 "", 1574 "",
1575 FileBrowseUI::kPopupWidth, 1575 FileBrowseUI::kPopupWidth,
1576 FileBrowseUI::kPopupHeight); 1576 FileBrowseUI::kPopupHeight);
1577 #else 1577 #else
1578 if (!select_file_dialog_.get()) 1578 if (!select_file_dialog_.get())
1579 select_file_dialog_ = SelectFileDialog::Create(this); 1579 select_file_dialog_ = SelectFileDialog::Create(this);
1580 1580
1581 const FilePath directory = profile_->last_selected_directory();
1582
1581 // TODO(beng): figure out how to juggle this. 1583 // TODO(beng): figure out how to juggle this.
1582 gfx::NativeWindow parent_window = window_->GetNativeHandle(); 1584 gfx::NativeWindow parent_window = window_->GetNativeHandle();
1583 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, 1585 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE,
1584 string16(), FilePath(), 1586 string16(), directory,
1585 NULL, 0, FILE_PATH_LITERAL(""), 1587 NULL, 0, FILE_PATH_LITERAL(""),
1586 parent_window, NULL); 1588 parent_window, NULL);
1587 #endif 1589 #endif
1588 } 1590 }
1589 1591
1590 void Browser::OpenCreateShortcutsDialog() { 1592 void Browser::OpenCreateShortcutsDialog() {
1591 UserMetrics::RecordAction(UserMetricsAction("CreateShortcut"), profile_); 1593 UserMetrics::RecordAction(UserMetricsAction("CreateShortcut"), profile_);
1592 #if defined(OS_WIN) || defined(OS_LINUX) 1594 #if defined(OS_WIN) || defined(OS_LINUX)
1593 TabContents* current_tab = GetSelectedTabContents(); 1595 TabContents* current_tab = GetSelectedTabContents();
1594 DCHECK(current_tab && web_app::IsValidUrl(current_tab->GetURL())) << 1596 DCHECK(current_tab && web_app::IsValidUrl(current_tab->GetURL())) <<
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2843 break; 2845 break;
2844 } 2846 }
2845 2847
2846 pending_web_app_action_ = NONE; 2848 pending_web_app_action_ = NONE;
2847 } 2849 }
2848 2850
2849 /////////////////////////////////////////////////////////////////////////////// 2851 ///////////////////////////////////////////////////////////////////////////////
2850 // Browser, SelectFileDialog::Listener implementation: 2852 // Browser, SelectFileDialog::Listener implementation:
2851 2853
2852 void Browser::FileSelected(const FilePath& path, int index, void* params) { 2854 void Browser::FileSelected(const FilePath& path, int index, void* params) {
2855 profile_->set_last_selected_directory(path.DirName());
2853 GURL file_url = net::FilePathToFileURL(path); 2856 GURL file_url = net::FilePathToFileURL(path);
2854 if (!file_url.is_empty()) 2857 if (!file_url.is_empty())
2855 OpenURL(file_url, GURL(), CURRENT_TAB, PageTransition::TYPED); 2858 OpenURL(file_url, GURL(), CURRENT_TAB, PageTransition::TYPED);
2856 } 2859 }
2857 2860
2858 2861
2859 /////////////////////////////////////////////////////////////////////////////// 2862 ///////////////////////////////////////////////////////////////////////////////
2860 // Browser, NotificationObserver implementation: 2863 // Browser, NotificationObserver implementation:
2861 2864
2862 void Browser::Observe(NotificationType type, 2865 void Browser::Observe(NotificationType type,
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
3917 } 3920 }
3918 3921
3919 bool Browser::IsPinned(TabContents* source) { 3922 bool Browser::IsPinned(TabContents* source) {
3920 int index = tabstrip_model_.GetIndexOfTabContents(source); 3923 int index = tabstrip_model_.GetIndexOfTabContents(source);
3921 if (index == TabStripModel::kNoTab) { 3924 if (index == TabStripModel::kNoTab) {
3922 NOTREACHED() << "IsPinned called for tab not in our strip"; 3925 NOTREACHED() << "IsPinned called for tab not in our strip";
3923 return false; 3926 return false;
3924 } 3927 }
3925 return tabstrip_model_.IsTabPinned(index); 3928 return tabstrip_model_.IsTabPinned(index);
3926 } 3929 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698