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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/change_picture_options_handler.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 4
5 #include "chrome/browser/ui/webui/options2/chromeos/change_picture_options_handl er.h" 5 #include "chrome/browser/ui/webui/options2/chromeos/change_picture_options_handl er.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 24 matching lines...) Expand all
35 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
37 #include "ui/views/widget/widget.h" 37 #include "ui/views/widget/widget.h"
38 38
39 namespace chromeos { 39 namespace chromeos {
40 namespace options2 { 40 namespace options2 {
41 41
42 namespace { 42 namespace {
43 43
44 // Returns info about extensions for files we support as user images. 44 // Returns info about extensions for files we support as user images.
45 SelectFileDialog::FileTypeInfo GetUserImageFileTypeInfo() { 45 ui::SelectFileDialog::FileTypeInfo GetUserImageFileTypeInfo() {
46 SelectFileDialog::FileTypeInfo file_type_info; 46 ui::SelectFileDialog::FileTypeInfo file_type_info;
47 file_type_info.extensions.resize(5); 47 file_type_info.extensions.resize(5);
48 48
49 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("bmp")); 49 file_type_info.extensions[0].push_back(FILE_PATH_LITERAL("bmp"));
50 50
51 file_type_info.extensions[1].push_back(FILE_PATH_LITERAL("gif")); 51 file_type_info.extensions[1].push_back(FILE_PATH_LITERAL("gif"));
52 52
53 file_type_info.extensions[2].push_back(FILE_PATH_LITERAL("jpg")); 53 file_type_info.extensions[2].push_back(FILE_PATH_LITERAL("jpg"));
54 file_type_info.extensions[2].push_back(FILE_PATH_LITERAL("jpeg")); 54 file_type_info.extensions[2].push_back(FILE_PATH_LITERAL("jpeg"));
55 55
56 file_type_info.extensions[3].push_back(FILE_PATH_LITERAL("png")); 56 file_type_info.extensions[3].push_back(FILE_PATH_LITERAL("png"));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 ListValue image_urls; 134 ListValue image_urls;
135 for (int i = 0; i < kDefaultImagesCount; ++i) { 135 for (int i = 0; i < kDefaultImagesCount; ++i) {
136 image_urls.Append(new StringValue(GetDefaultImageUrl(i))); 136 image_urls.Append(new StringValue(GetDefaultImageUrl(i)));
137 } 137 }
138 web_ui()->CallJavascriptFunction("ChangePictureOptions.setDefaultImages", 138 web_ui()->CallJavascriptFunction("ChangePictureOptions.setDefaultImages",
139 image_urls); 139 image_urls);
140 } 140 }
141 141
142 void ChangePictureOptionsHandler::HandleChooseFile(const ListValue* args) { 142 void ChangePictureOptionsHandler::HandleChooseFile(const ListValue* args) {
143 DCHECK(args && args->empty()); 143 DCHECK(args && args->empty());
144 select_file_dialog_ = SelectFileDialog::Create( 144 select_file_dialog_ = ui::SelectFileDialog::Create(
145 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents())); 145 this, new ChromeSelectFilePolicy(web_ui()->GetWebContents()));
146 146
147 FilePath downloads_path; 147 FilePath downloads_path;
148 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_path)) { 148 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &downloads_path)) {
149 NOTREACHED(); 149 NOTREACHED();
150 return; 150 return;
151 } 151 }
152 152
153 // Static so we initialize it only once. 153 // Static so we initialize it only once.
154 CR_DEFINE_STATIC_LOCAL(SelectFileDialog::FileTypeInfo, file_type_info, 154 CR_DEFINE_STATIC_LOCAL(ui::SelectFileDialog::FileTypeInfo, file_type_info,
155 (GetUserImageFileTypeInfo())); 155 (GetUserImageFileTypeInfo()));
156 156
157 select_file_dialog_->SelectFile( 157 select_file_dialog_->SelectFile(
158 SelectFileDialog::SELECT_OPEN_FILE, 158 ui::SelectFileDialog::SELECT_OPEN_FILE,
159 l10n_util::GetStringUTF16(IDS_DOWNLOAD_TITLE), 159 l10n_util::GetStringUTF16(IDS_DOWNLOAD_TITLE),
160 downloads_path, 160 downloads_path,
161 &file_type_info, 161 &file_type_info,
162 0, 162 0,
163 FILE_PATH_LITERAL(""), 163 FILE_PATH_LITERAL(""),
164 GetBrowserWindow(), 164 GetBrowserWindow(),
165 NULL); 165 NULL);
166 } 166 }
167 167
168 void ChangePictureOptionsHandler::HandleTakePhoto(const ListValue* args) { 168 void ChangePictureOptionsHandler::HandleTakePhoto(const ListValue* args) {
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 OnPhotoAccepted(user_photo_); 414 OnPhotoAccepted(user_photo_);
415 } 415 }
416 416
417 void ChangePictureOptionsHandler::OnDecodeImageFailed( 417 void ChangePictureOptionsHandler::OnDecodeImageFailed(
418 const ImageDecoder* decoder) { 418 const ImageDecoder* decoder) {
419 NOTREACHED() << "Failed to decode PNG image from WebUI"; 419 NOTREACHED() << "Failed to decode PNG image from WebUI";
420 } 420 }
421 421
422 } // namespace options2 422 } // namespace options2
423 } // namespace chromeos 423 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698