OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/shell_dialogs.h" | 5 #include "chrome/browser/ui/shell_dialogs.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 const std::string& json) { | 223 const std::string& json) { |
224 // Nothing to do if listener_ is gone. | 224 // Nothing to do if listener_ is gone. |
225 | 225 |
226 if (!listener_) | 226 if (!listener_) |
227 return; | 227 return; |
228 | 228 |
229 bool notification_fired = false; | 229 bool notification_fired = false; |
230 | 230 |
231 if (!json.empty()) { | 231 if (!json.empty()) { |
232 scoped_ptr<Value> value(base::JSONReader::Read(json, false)); | 232 scoped_ptr<Value> value(base::JSONReader::Read(json, false)); |
233 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) { | 233 if (!value.get() || !value->IsDictionary()) { |
234 // Bad json value returned. | 234 // Bad json value returned. |
235 NOTREACHED(); | 235 NOTREACHED(); |
236 } else { | 236 } else { |
237 const DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); | 237 const DictionaryValue* dict = static_cast<DictionaryValue*>(value.get()); |
238 if (delegate->type_ == SELECT_OPEN_FILE || | 238 if (delegate->type_ == SELECT_OPEN_FILE || |
239 delegate->type_ == SELECT_SAVEAS_FILE || | 239 delegate->type_ == SELECT_SAVEAS_FILE || |
240 delegate->type_ == SELECT_FOLDER) { | 240 delegate->type_ == SELECT_FOLDER) { |
241 std::string path_string; | 241 std::string path_string; |
242 if (dict->HasKey(kKeyNamePath) && | 242 if (dict->HasKey(kKeyNamePath) && |
243 dict->GetString(kKeyNamePath, &path_string)) { | 243 dict->GetString(kKeyNamePath, &path_string)) { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 // TODO(xiyuan): Change this when the infrastructure is improved. | 457 // TODO(xiyuan): Change this when the infrastructure is improved. |
458 HtmlDialogUIDelegate** delegate = HtmlDialogUI::GetPropertyAccessor(). | 458 HtmlDialogUIDelegate** delegate = HtmlDialogUI::GetPropertyAccessor(). |
459 GetProperty(web_ui_->tab_contents()->property_bag()); | 459 GetProperty(web_ui_->tab_contents()->property_bag()); |
460 HtmlDialogView* containing_view = static_cast<HtmlDialogView*>(*delegate); | 460 HtmlDialogView* containing_view = static_cast<HtmlDialogView*>(*delegate); |
461 DCHECK(containing_view); | 461 DCHECK(containing_view); |
462 | 462 |
463 containing_view->GetWindow()->UpdateWindowTitle(); | 463 containing_view->GetWindow()->UpdateWindowTitle(); |
464 containing_view->GetWindow()->non_client_view()->SchedulePaint(); | 464 containing_view->GetWindow()->non_client_view()->SchedulePaint(); |
465 } | 465 } |
466 } | 466 } |
OLD | NEW |