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

Side by Side Diff: chrome/browser/ui/views/select_file_dialog_extension.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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 #include "chrome/browser/ui/views/select_file_dialog_extension.h" 5 #include "chrome/browser/ui/views/select_file_dialog_extension.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class PendingDialog { 53 class PendingDialog {
54 public: 54 public:
55 static PendingDialog* GetInstance(); 55 static PendingDialog* GetInstance();
56 void Add(SelectFileDialogExtension::RoutingID id, 56 void Add(SelectFileDialogExtension::RoutingID id,
57 scoped_refptr<SelectFileDialogExtension> dialog); 57 scoped_refptr<SelectFileDialogExtension> dialog);
58 void Remove(SelectFileDialogExtension::RoutingID id); 58 void Remove(SelectFileDialogExtension::RoutingID id);
59 scoped_refptr<SelectFileDialogExtension> Find( 59 scoped_refptr<SelectFileDialogExtension> Find(
60 SelectFileDialogExtension::RoutingID id); 60 SelectFileDialogExtension::RoutingID id);
61 61
62 private: 62 private:
63 friend struct DefaultSingletonTraits<PendingDialog>; 63 friend struct base::DefaultSingletonTraits<PendingDialog>;
64 typedef std::map<SelectFileDialogExtension::RoutingID, 64 typedef std::map<SelectFileDialogExtension::RoutingID,
65 scoped_refptr<SelectFileDialogExtension> > Map; 65 scoped_refptr<SelectFileDialogExtension> > Map;
66 Map map_; 66 Map map_;
67 }; 67 };
68 68
69 // static 69 // static
70 PendingDialog* PendingDialog::GetInstance() { 70 PendingDialog* PendingDialog::GetInstance() {
71 return Singleton<PendingDialog>::get(); 71 return base::Singleton<PendingDialog>::get();
72 } 72 }
73 73
74 void PendingDialog::Add(SelectFileDialogExtension::RoutingID id, 74 void PendingDialog::Add(SelectFileDialogExtension::RoutingID id,
75 scoped_refptr<SelectFileDialogExtension> dialog) { 75 scoped_refptr<SelectFileDialogExtension> dialog) {
76 DCHECK(dialog.get()); 76 DCHECK(dialog.get());
77 if (map_.find(id) == map_.end()) 77 if (map_.find(id) == map_.end())
78 map_.insert(std::make_pair(id, dialog)); 78 map_.insert(std::make_pair(id, dialog));
79 else 79 else
80 DLOG(WARNING) << "Duplicate pending dialog " << id; 80 DLOG(WARNING) << "Duplicate pending dialog " << id;
81 } 81 }
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 422
423 // Connect our listener to FileDialogFunction's per-tab callbacks. 423 // Connect our listener to FileDialogFunction's per-tab callbacks.
424 AddPending(routing_id); 424 AddPending(routing_id);
425 425
426 extension_dialog_ = dialog; 426 extension_dialog_ = dialog;
427 params_ = params; 427 params_ = params;
428 routing_id_ = routing_id; 428 routing_id_ = routing_id;
429 owner_window_ = owner_window; 429 owner_window_ = owner_window;
430 } 430 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698