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

Side by Side Diff: chrome/browser/media/media_stream_capture_indicator.h

Issue 11273060: Change MediaStreamCaptureIndicator back to ref counted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ 5 #ifndef CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_
6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ 6 #define CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/extensions/image_loading_tracker.h" 13 #include "chrome/browser/extensions/image_loading_tracker.h"
13 #include "content/public/common/media_stream_request.h" 14 #include "content/public/common/media_stream_request.h"
14 #include "ui/base/models/simple_menu_model.h" 15 #include "ui/base/models/simple_menu_model.h"
15 #include "ui/gfx/image/image_skia.h" 16 #include "ui/gfx/image/image_skia.h"
16 17
17 class StatusIcon; 18 class StatusIcon;
18 class StatusTray; 19 class StatusTray;
19 20
20 // This indicator is owned by MediaInternals and deleted when MediaInternals 21 // This indicator is owned by MediaInternals and deleted when MediaInternals
21 // is deleted. 22 // is deleted.
22 class MediaStreamCaptureIndicator : public ui::SimpleMenuModel::Delegate, 23 class MediaStreamCaptureIndicator
23 public ImageLoadingTracker::Observer { 24 : public base::RefCountedThreadSafe<MediaStreamCaptureIndicator>,
25 public ui::SimpleMenuModel::Delegate,
26 public ImageLoadingTracker::Observer {
24 public: 27 public:
25 MediaStreamCaptureIndicator(); 28 MediaStreamCaptureIndicator();
26 virtual ~MediaStreamCaptureIndicator();
27 29
28 // Overrides from SimpleMenuModel::Delegate implementation. 30 // Overrides from SimpleMenuModel::Delegate implementation.
29 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 31 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE;
30 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 32 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE;
31 virtual bool GetAcceleratorForCommandId( 33 virtual bool GetAcceleratorForCommandId(
32 int command_id, 34 int command_id,
33 ui::Accelerator* accelerator) OVERRIDE; 35 ui::Accelerator* accelerator) OVERRIDE;
34 virtual void ExecuteCommand(int command_id) OVERRIDE; 36 virtual void ExecuteCommand(int command_id) OVERRIDE;
35 37
36 // Called on IO thread when MediaStream opens new capture devices. 38 // Called on IO thread when MediaStream opens new capture devices.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 TabEquals(int render_process_id, int render_view_id); 78 TabEquals(int render_process_id, int render_view_id);
77 79
78 bool operator() ( 80 bool operator() (
79 const MediaStreamCaptureIndicator::CaptureDeviceTab& tab); 81 const MediaStreamCaptureIndicator::CaptureDeviceTab& tab);
80 82
81 private: 83 private:
82 int render_process_id_; 84 int render_process_id_;
83 int render_view_id_; 85 int render_view_id_;
84 }; 86 };
85 87
88 friend class base::RefCountedThreadSafe<MediaStreamCaptureIndicator>;
89 virtual ~MediaStreamCaptureIndicator();
90
86 // Called by the public functions, executed on UI thread. 91 // Called by the public functions, executed on UI thread.
87 void DoDevicesOpenedOnUIThread(int render_process_id, 92 void DoDevicesOpenedOnUIThread(int render_process_id,
88 int render_view_id, 93 int render_view_id,
89 const content::MediaStreamDevices& devices); 94 const content::MediaStreamDevices& devices);
90 void DoDevicesClosedOnUIThread(int render_process_id, 95 void DoDevicesClosedOnUIThread(int render_process_id,
91 int render_view_id, 96 int render_view_id,
92 const content::MediaStreamDevices& devices); 97 const content::MediaStreamDevices& devices);
93 98
94 // Following functions/variables are executed/accessed only on UI thread. 99 // Following functions/variables are executed/accessed only on UI thread.
95 // Creates the status tray if it has not been created. 100 // Creates the status tray if it has not been created.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 typedef std::vector<CaptureDeviceTab> CaptureDeviceTabs; 147 typedef std::vector<CaptureDeviceTab> CaptureDeviceTabs;
143 CaptureDeviceTabs tabs_; 148 CaptureDeviceTabs tabs_;
144 149
145 // Tracks the load of extension icons. 150 // Tracks the load of extension icons.
146 scoped_ptr<ImageLoadingTracker> tracker_; 151 scoped_ptr<ImageLoadingTracker> tracker_;
147 // The messages to display when extension images are loaded. The index 152 // The messages to display when extension images are loaded. The index
148 // corresponds to the index of the associated LoadImage request. 153 // corresponds to the index of the associated LoadImage request.
149 std::map<int, string16> pending_messages_; 154 std::map<int, string16> pending_messages_;
150 // Tracks the number of requests to |tracker_|. 155 // Tracks the number of requests to |tracker_|.
151 int request_index_; 156 int request_index_;
152
153 base::WeakPtrFactory<MediaStreamCaptureIndicator> weak_ptr_factory_;
154
155 DISALLOW_COPY_AND_ASSIGN(MediaStreamCaptureIndicator);
156 }; 157 };
157 158
158 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_ 159 #endif // CHROME_BROWSER_MEDIA_MEDIA_STREAM_CAPTURE_INDICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698