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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api.cc

Issue 1036723003: favor DCHECK_CURRENTLY_ON for better logs in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 // The file contains the implementation of 5 // The file contains the implementation of
6 // fileBrowserHandlerInternal.selectFile extension function. 6 // fileBrowserHandlerInternal.selectFile extension function.
7 // When invoked, the function does the following: 7 // When invoked, the function does the following:
8 // - Verifies that the extension function was invoked as a result of user 8 // - Verifies that the extension function was invoked as a result of user
9 // gesture. 9 // gesture.
10 // - Display 'save as' dialog using FileSelectorImpl which waits for the user 10 // - Display 'save as' dialog using FileSelectorImpl which waits for the user
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 base::MessageLoopProxy::current()->PostTask(FROM_HERE, 181 base::MessageLoopProxy::current()->PostTask(FROM_HERE,
182 base::Bind(&FileSelectorImpl::FileSelectionCanceled, 182 base::Bind(&FileSelectorImpl::FileSelectionCanceled,
183 base::Unretained(this), static_cast<void*>(NULL))); 183 base::Unretained(this), static_cast<void*>(NULL)));
184 } 184 }
185 } 185 }
186 186
187 bool FileSelectorImpl::StartSelectFile( 187 bool FileSelectorImpl::StartSelectFile(
188 const base::FilePath& suggested_name, 188 const base::FilePath& suggested_name,
189 const std::vector<std::string>& allowed_extensions, 189 const std::vector<std::string>& allowed_extensions,
190 Browser* browser) { 190 Browser* browser) {
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 191 DCHECK_CURRENTLY_ON(BrowserThread::UI);
192 DCHECK(!dialog_.get()); 192 DCHECK(!dialog_.get());
193 DCHECK(browser); 193 DCHECK(browser);
194 194
195 if (!browser->window()) 195 if (!browser->window())
196 return false; 196 return false;
197 197
198 content::WebContents* web_contents = 198 content::WebContents* web_contents =
199 browser->tab_strip_model()->GetActiveWebContents(); 199 browser->tab_strip_model()->GetActiveWebContents();
200 if (!web_contents) 200 if (!web_contents)
201 return false; 201 return false;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 234
235 void FileSelectorImpl::FileSelectionCanceled( 235 void FileSelectorImpl::FileSelectionCanceled(
236 void* params) { 236 void* params) {
237 SendResponse(false, base::FilePath()); 237 SendResponse(false, base::FilePath());
238 delete this; 238 delete this;
239 } 239 }
240 240
241 void FileSelectorImpl::SendResponse(bool success, 241 void FileSelectorImpl::SendResponse(bool success,
242 const base::FilePath& selected_path) { 242 const base::FilePath& selected_path) {
243 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 243 DCHECK_CURRENTLY_ON(BrowserThread::UI);
244 244
245 // We don't want to send multiple responses. 245 // We don't want to send multiple responses.
246 if (function_.get()) 246 if (function_.get())
247 function_->OnFilePathSelected(success, selected_path); 247 function_->OnFilePathSelected(success, selected_path);
248 function_ = NULL; 248 function_ = NULL;
249 } 249 }
250 250
251 // FileSelectorFactory implementation. 251 // FileSelectorFactory implementation.
252 class FileSelectorFactoryImpl : public FileSelectorFactory { 252 class FileSelectorFactoryImpl : public FileSelectorFactory {
253 public: 253 public:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 file_selector->SelectFile(suggested_name.BaseName(), 301 file_selector->SelectFile(suggested_name.BaseName(),
302 allowed_extensions, 302 allowed_extensions,
303 GetCurrentBrowser(), 303 GetCurrentBrowser(),
304 this); 304 this);
305 return true; 305 return true;
306 } 306 }
307 307
308 void FileBrowserHandlerInternalSelectFileFunction::OnFilePathSelected( 308 void FileBrowserHandlerInternalSelectFileFunction::OnFilePathSelected(
309 bool success, 309 bool success,
310 const base::FilePath& full_path) { 310 const base::FilePath& full_path) {
311 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 311 DCHECK_CURRENTLY_ON(BrowserThread::UI);
312 312
313 if (!success) { 313 if (!success) {
314 Respond(EntryDefinition(), false); 314 Respond(EntryDefinition(), false);
315 return; 315 return;
316 } 316 }
317 317
318 storage::ExternalFileSystemBackend* external_backend = 318 storage::ExternalFileSystemBackend* external_backend =
319 file_manager::util::GetFileSystemContextForRenderViewHost( 319 file_manager::util::GetFileSystemContextForRenderViewHost(
320 GetProfile(), render_view_host())->external_backend(); 320 GetProfile(), render_view_host())->external_backend();
321 DCHECK(external_backend); 321 DCHECK(external_backend);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 result->entry->file_system_name = entry_definition.file_system_name; 365 result->entry->file_system_name = entry_definition.file_system_name;
366 result->entry->file_system_root = entry_definition.file_system_root_url; 366 result->entry->file_system_root = entry_definition.file_system_root_url;
367 result->entry->file_full_path = 367 result->entry->file_full_path =
368 "/" + entry_definition.full_path.AsUTF8Unsafe(); 368 "/" + entry_definition.full_path.AsUTF8Unsafe();
369 result->entry->file_is_directory = entry_definition.is_directory; 369 result->entry->file_is_directory = entry_definition.is_directory;
370 } 370 }
371 371
372 results_ = SelectFile::Results::Create(*result); 372 results_ = SelectFile::Results::Create(*result);
373 SendResponse(true); 373 SendResponse(true);
374 } 374 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698