Add ICU message format support
[chromium-blink-merge.git] / chrome / browser / ui / webui / media_router / media_router_dialog_controller_impl.h
blobadfbe6fa2c21b69e125376d80a099ad8dd287755
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
3 // found in the LICENSE file.
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_
8 #include "base/macros.h"
9 #include "chrome/browser/media/router/media_router_dialog_controller.h"
10 #include "content/public/browser/web_contents_observer.h"
11 #include "content/public/browser/web_contents_user_data.h"
13 namespace media_router {
15 // A desktop implementation of MediaRouterDialogController.
16 // This class is not thread safe and must be called on the UI thread.
17 class MediaRouterDialogControllerImpl :
18 public content::WebContentsUserData<MediaRouterDialogControllerImpl>,
19 public MediaRouterDialogController {
20 public:
21 ~MediaRouterDialogControllerImpl() override;
23 static MediaRouterDialogControllerImpl* GetOrCreateForWebContents(
24 content::WebContents* web_contents);
26 // Returns the media router dialog WebContents.
27 // Returns nullptr if there is no dialog.
28 content::WebContents* GetMediaRouterDialog() const;
31 private:
32 class DialogWebContentsObserver;
33 friend class content::WebContentsUserData<MediaRouterDialogControllerImpl>;
35 // Use MediaRouterDialogControllerImpl::CreateForWebContents() to create an
36 // instance.
37 explicit MediaRouterDialogControllerImpl(content::WebContents* web_contents);
39 // MediaRouterDialogController:
40 void CreateMediaRouterDialog() override;
41 void CloseMediaRouterDialog() override;
42 bool IsShowingMediaRouterDialog() const override;
43 void Reset() override;
45 // Invoked when the dialog WebContents has navigated.
46 void OnDialogNavigated(const content::LoadCommittedDetails& details);
48 void PopulateDialog(content::WebContents* media_router_dialog);
50 scoped_ptr<DialogWebContentsObserver> dialog_observer_;
52 // True if the controller is waiting for a new media router dialog to be
53 // created.
54 bool media_router_dialog_pending_;
56 DISALLOW_COPY_AND_ASSIGN(MediaRouterDialogControllerImpl);
59 } // namespace media_router
61 #endif // CHROME_BROWSER_UI_WEBUI_MEDIA_ROUTER_MEDIA_ROUTER_DIALOG_CONTROLLER_IMPL_H_