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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager_util.cc

Issue 10820034: Remove redirection header and add "ui::" before all SelectFileDialog usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reuploading for different try run. Created 8 years, 4 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 | Annotate | Revision Log
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 #include "chrome/browser/chromeos/extensions/file_manager_util.h" 4 #include "chrome/browser/chromeos/extensions/file_manager_util.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 for (size_t i = 0; i < array_size; i++) { 141 for (size_t i = 0; i < array_size; i++) {
142 if (base::strcasecmp(file_extension, array[i]) == 0) { 142 if (base::strcasecmp(file_extension, array[i]) == 0) {
143 return i; 143 return i;
144 } 144 }
145 } 145 }
146 return 0; 146 return 0;
147 } 147 }
148 148
149 // Convert numeric dialog type to a string. 149 // Convert numeric dialog type to a string.
150 std::string GetDialogTypeAsString( 150 std::string GetDialogTypeAsString(
151 SelectFileDialog::Type dialog_type) { 151 ui::SelectFileDialog::Type dialog_type) {
152 std::string type_str; 152 std::string type_str;
153 switch (dialog_type) { 153 switch (dialog_type) {
154 case SelectFileDialog::SELECT_NONE: 154 case ui::SelectFileDialog::SELECT_NONE:
155 type_str = "full-page"; 155 type_str = "full-page";
156 break; 156 break;
157 157
158 case SelectFileDialog::SELECT_FOLDER: 158 case ui::SelectFileDialog::SELECT_FOLDER:
159 type_str = "folder"; 159 type_str = "folder";
160 break; 160 break;
161 161
162 case SelectFileDialog::SELECT_SAVEAS_FILE: 162 case ui::SelectFileDialog::SELECT_SAVEAS_FILE:
163 type_str = "saveas-file"; 163 type_str = "saveas-file";
164 break; 164 break;
165 165
166 case SelectFileDialog::SELECT_OPEN_FILE: 166 case ui::SelectFileDialog::SELECT_OPEN_FILE:
167 type_str = "open-file"; 167 type_str = "open-file";
168 break; 168 break;
169 169
170 case SelectFileDialog::SELECT_OPEN_MULTI_FILE: 170 case ui::SelectFileDialog::SELECT_OPEN_MULTI_FILE:
171 type_str = "open-multi-file"; 171 type_str = "open-multi-file";
172 break; 172 break;
173 173
174 default: 174 default:
175 NOTREACHED(); 175 NOTREACHED();
176 } 176 }
177 177
178 return type_str; 178 return type_str;
179 } 179 }
180 180
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 return false; 296 return false;
297 297
298 // Find if this file path is managed by the external provider. 298 // Find if this file path is managed by the external provider.
299 if (!provider->GetVirtualPath(full_file_path, virtual_path)) 299 if (!provider->GetVirtualPath(full_file_path, virtual_path))
300 return false; 300 return false;
301 301
302 return true; 302 return true;
303 } 303 }
304 304
305 GURL GetFileBrowserUrlWithParams( 305 GURL GetFileBrowserUrlWithParams(
306 SelectFileDialog::Type type, 306 ui::SelectFileDialog::Type type,
307 const string16& title, 307 const string16& title,
308 const FilePath& default_virtual_path, 308 const FilePath& default_virtual_path,
309 const SelectFileDialog::FileTypeInfo* file_types, 309 const ui::SelectFileDialog::FileTypeInfo* file_types,
310 int file_type_index, 310 int file_type_index,
311 const FilePath::StringType& default_extension) { 311 const FilePath::StringType& default_extension) {
312 DictionaryValue arg_value; 312 DictionaryValue arg_value;
313 arg_value.SetString("type", GetDialogTypeAsString(type)); 313 arg_value.SetString("type", GetDialogTypeAsString(type));
314 arg_value.SetString("title", title); 314 arg_value.SetString("title", title);
315 arg_value.SetString("defaultPath", default_virtual_path.value()); 315 arg_value.SetString("defaultPath", default_virtual_path.value());
316 arg_value.SetString("defaultExtension", default_extension); 316 arg_value.SetString("defaultExtension", default_extension);
317 317
318 if (file_types) { 318 if (file_types) {
319 ListValue* types_list = new ListValue(); 319 ListValue* types_list = new ListValue();
(...skipping 23 matching lines...) Expand all
343 std::string json_args; 343 std::string json_args;
344 base::JSONWriter::Write(&arg_value, &json_args); 344 base::JSONWriter::Write(&arg_value, &json_args);
345 345
346 // kChromeUIFileManagerURL could not be used since query parameters are not 346 // kChromeUIFileManagerURL could not be used since query parameters are not
347 // supported for it. 347 // supported for it.
348 std::string url = GetFileBrowserUrl().spec() + 348 std::string url = GetFileBrowserUrl().spec() +
349 '?' + net::EscapeUrlEncodedData(json_args, false); 349 '?' + net::EscapeUrlEncodedData(json_args, false);
350 return GURL(url); 350 return GURL(url);
351 } 351 }
352 352
353 string16 GetTitleFromType(SelectFileDialog::Type dialog_type) { 353 string16 GetTitleFromType(ui::SelectFileDialog::Type dialog_type) {
354 string16 title; 354 string16 title;
355 switch (dialog_type) { 355 switch (dialog_type) {
356 case SelectFileDialog::SELECT_NONE: 356 case ui::SelectFileDialog::SELECT_NONE:
357 // Full page file manager doesn't need a title. 357 // Full page file manager doesn't need a title.
358 break; 358 break;
359 359
360 case SelectFileDialog::SELECT_FOLDER: 360 case ui::SelectFileDialog::SELECT_FOLDER:
361 title = l10n_util::GetStringUTF16( 361 title = l10n_util::GetStringUTF16(
362 IDS_FILE_BROWSER_SELECT_FOLDER_TITLE); 362 IDS_FILE_BROWSER_SELECT_FOLDER_TITLE);
363 break; 363 break;
364 364
365 case SelectFileDialog::SELECT_SAVEAS_FILE: 365 case ui::SelectFileDialog::SELECT_SAVEAS_FILE:
366 title = l10n_util::GetStringUTF16( 366 title = l10n_util::GetStringUTF16(
367 IDS_FILE_BROWSER_SELECT_SAVEAS_FILE_TITLE); 367 IDS_FILE_BROWSER_SELECT_SAVEAS_FILE_TITLE);
368 break; 368 break;
369 369
370 case SelectFileDialog::SELECT_OPEN_FILE: 370 case ui::SelectFileDialog::SELECT_OPEN_FILE:
371 title = l10n_util::GetStringUTF16( 371 title = l10n_util::GetStringUTF16(
372 IDS_FILE_BROWSER_SELECT_OPEN_FILE_TITLE); 372 IDS_FILE_BROWSER_SELECT_OPEN_FILE_TITLE);
373 break; 373 break;
374 374
375 case SelectFileDialog::SELECT_OPEN_MULTI_FILE: 375 case ui::SelectFileDialog::SELECT_OPEN_MULTI_FILE:
376 title = l10n_util::GetStringUTF16( 376 title = l10n_util::GetStringUTF16(
377 IDS_FILE_BROWSER_SELECT_OPEN_MULTI_FILE_TITLE); 377 IDS_FILE_BROWSER_SELECT_OPEN_MULTI_FILE_TITLE);
378 break; 378 break;
379 379
380 default: 380 default:
381 NOTREACHED(); 381 NOTREACHED();
382 } 382 }
383 383
384 return title; 384 return title;
385 } 385 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 GDataOperationRegistry::ProgressStatus>::const_iterator iter = 716 GDataOperationRegistry::ProgressStatus>::const_iterator iter =
717 list.begin(); 717 list.begin();
718 iter != list.end(); ++iter) { 718 iter != list.end(); ++iter) {
719 result_list->Append( 719 result_list->Append(
720 ProgessStatusToDictionaryValue(profile, origin_url, *iter)); 720 ProgessStatusToDictionaryValue(profile, origin_url, *iter));
721 } 721 }
722 return result_list.release(); 722 return result_list.release();
723 } 723 }
724 724
725 } // namespace file_manager_util 725 } // namespace file_manager_util
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/file_manager_util.h ('k') | chrome/browser/chromeos/options/vpn_config_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698