2 * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef BROWSER_POPUP_H_
18 #define BROWSER_POPUP_H_
20 #include <Elementary.h>
25 #include "base/callback.h"
27 #if BUILDFLAG(IS_TIZEN_TV)
28 #include "base/timer/timer.h"
35 enum class ButtonType {
42 enum class EntryType {
47 static std::unique_ptr<Popup> CreatePopup(Evas_Object* window);
48 static void Show(std::unique_ptr<Popup> popup);
49 static void ForceCloseAllPopup();
53 void SetButtonType(ButtonType type);
54 void SetFirstEntry(const std::string& id, EntryType type);
55 void SetSecondEntry(const std::string& id, EntryType type);
56 void SetCheckBox(const std::string& id);
57 void SetTitle(const std::string& id);
58 void SetBody(const std::string& id);
60 typedef base::OnceCallback<void(
61 bool is_positive, bool is_checked,
62 const std::string& entry1, const std::string& entry2)>
65 void SetResultHandler(ResultHandler handler);
67 #if BUILDFLAG(IS_TIZEN_TV)
68 static void ShowVoiceRecognitionToast(const std::string& app_title);
69 static void HideVoiceRecognitionToast();
71 void HandleEntryKeyDownEvent(const std::string& key);
75 Popup(Evas_Object* popup, Evas_Object* box);
77 Evas_Object* AddButton(const char* id, const char* content,
78 const char* button_style);
79 Evas_Object* AddEntry(const char* id, Popup::EntryType type);
81 void HandleButtonClickEvent(Evas_Object* button);
85 #if BUILDFLAG(IS_TIZEN_TV)
88 base::OneShotTimer timeout_timer_;
93 Evas_Object* button1_ = nullptr;
94 Evas_Object* button2_ = nullptr;
95 Evas_Object* entry1_ = nullptr;
96 Evas_Object* entry2_ = nullptr;
97 Evas_Object* check_box_ = nullptr;
99 ResultHandler handler_;
101 #ifdef OS_TIZEN_WEARABLE_PRODUCT
102 Evas_Object* layout_ = nullptr;
108 #endif // BROWSER_POPUP_H_