Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2009-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009-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 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" | 5 #import "chrome/browser/cocoa/clear_browsing_data_controller.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | |
| 7 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
| 8 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
| 9 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| 11 #include "chrome/browser/browser.h" | |
| 12 #include "chrome/browser/browser_window.h" | |
| 10 #include "chrome/browser/browsing_data_remover.h" | 13 #include "chrome/browser/browsing_data_remover.h" |
| 11 #include "chrome/browser/pref_service.h" | 14 #include "chrome/browser/pref_service.h" |
| 12 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 13 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 17 #include "grit/locale_settings.h" | |
| 14 | 18 |
| 15 NSString* const kClearBrowsingDataControllerDidDelete = | 19 NSString* const kClearBrowsingDataControllerDidDelete = |
| 16 @"kClearBrowsingDataControllerDidDelete"; | 20 @"kClearBrowsingDataControllerDidDelete"; |
| 17 NSString* const kClearBrowsingDataControllerRemoveMask = | 21 NSString* const kClearBrowsingDataControllerRemoveMask = |
| 18 @"kClearBrowsingDataControllerRemoveMask"; | 22 @"kClearBrowsingDataControllerRemoveMask"; |
| 19 | 23 |
| 20 @interface ClearBrowsingDataController(Private) | 24 @interface ClearBrowsingDataController(Private) |
| 21 - (void)initFromPrefs; | 25 - (void)initFromPrefs; |
| 22 - (void)persistToPrefs; | 26 - (void)persistToPrefs; |
| 23 - (void)dataRemoverDidFinish; | 27 - (void)dataRemoverDidFinish; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 remover_->AddObserver(observer_.get()); | 149 remover_->AddObserver(observer_.get()); |
| 146 remover_->Remove([self removeMask]); | 150 remover_->Remove([self removeMask]); |
| 147 } | 151 } |
| 148 | 152 |
| 149 // Called when the user clicks the cancel button. All we need to do is stop | 153 // Called when the user clicks the cancel button. All we need to do is stop |
| 150 // the modal session. | 154 // the modal session. |
| 151 - (IBAction)cancel:(id)sender { | 155 - (IBAction)cancel:(id)sender { |
| 152 [self closeDialog]; | 156 [self closeDialog]; |
| 153 } | 157 } |
| 154 | 158 |
| 159 // Called when the user clicks the "Flash Player storage settings" button. | |
| 160 - (IBAction)openFlashPlayerSettings:(id)sender { | |
| 161 // The "Clear Data" dialog is app-modal on OS X. Hence, close it before | |
| 162 // opening a tab with flash settings. | |
| 163 [self closeDialog]; | |
| 164 | |
| 165 Browser* browser = Browser::Create(profile_); | |
|
viettrungluu
2010/02/22 00:57:40
Is this code common between platforms? Ought it no
| |
| 166 browser->OpenURL(GURL(l10n_util::GetStringUTF8(IDS_FLASH_STORAGE_URL)), | |
| 167 GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | |
| 168 browser->window()->Show(); | |
| 169 } | |
| 170 | |
| 155 - (void)closeDialog { | 171 - (void)closeDialog { |
| 156 ProfileControllerMap* map = Singleton<ProfileControllerMap>::get(); | 172 ProfileControllerMap* map = Singleton<ProfileControllerMap>::get(); |
| 157 ProfileControllerMap::iterator it = map->find(profile_); | 173 ProfileControllerMap::iterator it = map->find(profile_); |
| 158 if (it != map->end()) { | 174 if (it != map->end()) { |
| 159 map->erase(it); | 175 map->erase(it); |
| 160 } | 176 } |
| 161 [self autorelease]; | 177 [self autorelease]; |
| 162 [[self window] orderOut:self]; | 178 [[self window] orderOut:self]; |
| 163 [NSApp stopModal]; | 179 [NSApp stopModal]; |
| 164 } | 180 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 object:self | 219 object:self |
| 204 userInfo:userInfo]; | 220 userInfo:userInfo]; |
| 205 | 221 |
| 206 [self closeDialog]; | 222 [self closeDialog]; |
| 207 [[self window] orderOut:self]; | 223 [[self window] orderOut:self]; |
| 208 [self setIsClearing:NO]; | 224 [self setIsClearing:NO]; |
| 209 remover_ = NULL; | 225 remover_ = NULL; |
| 210 } | 226 } |
| 211 | 227 |
| 212 @end | 228 @end |
| OLD | NEW |