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

Side by Side Diff: chrome/browser/ui/webui/media_router/media_router_dialog_controller_impl.h

Issue 2410553002: Show Media Router toolbar icon ephemerally for MR dialogs (Closed)
Patch Set: Deleted the first patch set on accident, responded to Mark's comments inline below Created 4 years, 2 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_IMPL _H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_IMPL _H_
6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_IMPL _H_ 6 #define CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_IMPL _H_
7 7
8 #include "base/gtest_prod_util.h" 8 #include "base/gtest_prod_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/media/router/media_router_dialog_controller.h" 11 #include "chrome/browser/media/router/media_router_dialog_controller.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/browser/web_contents_user_data.h" 13 #include "content/public/browser/web_contents_user_data.h"
14 14
15 FORWARD_DECLARE_TEST(MediaRouterActionUnitTest, IconPressedState); 15 FORWARD_DECLARE_TEST(MediaRouterActionUnitTest, IconPressedState);
16 16
17 class MediaRouterAction; 17 class MediaRouterAction;
18 class MediaRouterActionController;
18 19
19 namespace media_router { 20 namespace media_router {
20 21
21 // A desktop implementation of MediaRouterDialogController. 22 // A desktop implementation of MediaRouterDialogController.
22 // This class is not thread safe and must be called on the UI thread. 23 // This class is not thread safe and must be called on the UI thread.
23 class MediaRouterDialogControllerImpl : 24 class MediaRouterDialogControllerImpl :
24 public content::WebContentsUserData<MediaRouterDialogControllerImpl>, 25 public content::WebContentsUserData<MediaRouterDialogControllerImpl>,
25 public MediaRouterDialogController { 26 public MediaRouterDialogController {
26 public: 27 public:
27 ~MediaRouterDialogControllerImpl() override; 28 ~MediaRouterDialogControllerImpl() override;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 69
69 // |action_| refers to the MediaRouterAction on the toolbar, rather than 70 // |action_| refers to the MediaRouterAction on the toolbar, rather than
70 // overflow menu. A MediaRouterAction is always created for the toolbar 71 // overflow menu. A MediaRouterAction is always created for the toolbar
71 // first. Any subsequent creations for the overflow menu will not be set as 72 // first. Any subsequent creations for the overflow menu will not be set as
72 // |action_|. 73 // |action_|.
73 // The lifetime of |action_| is dependent on the creation and destruction of 74 // The lifetime of |action_| is dependent on the creation and destruction of
74 // a browser window. The overflow menu's MediaRouterAction is only created 75 // a browser window. The overflow menu's MediaRouterAction is only created
75 // when the overflow menu is opened and destroyed when the menu is closed. 76 // when the overflow menu is opened and destroyed when the menu is closed.
76 base::WeakPtr<MediaRouterAction> action_; 77 base::WeakPtr<MediaRouterAction> action_;
77 78
79 // |action_controller_| is responsible for showing and hiding the toolbar
80 // action. It's owned by MediaRouterUIService, which outlives |this|.
81 MediaRouterActionController* action_controller_;
82
78 base::WeakPtrFactory<MediaRouterDialogControllerImpl> weak_ptr_factory_; 83 base::WeakPtrFactory<MediaRouterDialogControllerImpl> weak_ptr_factory_;
79 84
80 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerImpl); 85 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerImpl);
81 }; 86 };
82 87
83 } // namespace media_router 88 } // namespace media_router
84 89
85 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_I MPL_H_ 90 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_I MPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698