Merge "Fix an issue that share menu is not work if there was no selected text" into...
[profile/ivi/org.tizen.browser.git] / src / browser-class.h
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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
7  *
8  *    http://www.tizenopensource.org/license
9  *
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.
15  *
16  */
17
18 #ifndef BROWSER_CLASS_H
19 #define BROWSER_CLASS_H
20
21 #include "browser-config.h"
22 #include "browser-view.h"
23
24 class Browser_Geolocation;
25 class Browser_Network_Manager;
26 class Browser_Policy_Decision_Maker;
27 class Browser_View;
28 class Browser_Window;
29 class Browser_User_Agent_DB;
30
31 class Browser_Class {
32 public:
33         Browser_Class(Evas_Object *win, Evas_Object *navi_bar, Evas_Object *bg);
34         ~Browser_Class(void);
35
36         Eina_Bool init(void);
37         Eina_Bool launch(const char *url, Eina_Bool new_window = EINA_FALSE);
38
39 #ifdef APP_IN_APP
40         Eina_Bool is_app_in_app(void);
41 #endif
42 #if defined(HORIZONTAL_UI)
43         void rotate(int degree);
44         Eina_Bool is_available_to_rotate(void);
45 #endif
46
47         Browser_Window *create_new_window(Eina_Bool created_by_user = EINA_FALSE);
48         void delete_window(Browser_Window *delete_window, Browser_Window *parent);
49         void delete_window(Browser_Window *window);
50         void change_order(std::vector<Browser_Window *> window_list);
51         std::vector<Browser_Window *> get_window_list(void) { return m_window_list; }
52         void set_focused_window(Browser_Window *window
53 #if defined(FEATURE_MOST_VISITED_SITES)
54                 , Eina_Bool show_most_visited_sites = EINA_TRUE
55 #endif
56         );
57         void pause(void);
58         void resume(void);
59         void reset(void);
60         void ewk_view_init(Evas_Object *ewk_view);
61         void ewk_view_deinit(Evas_Object *ewk_view);
62         std::string get_user_agent(void);
63         void clean_up_windows(void);
64         Browser_Window *create_deleted_window(int index);
65         Browser_Geolocation *get_geolocation(void) { return m_geolocation; }
66 private:
67         static Eina_Bool __create_network_manager_idler_cb(void *data);
68         Eina_Bool _set_ewk_view_options(Evas_Object *ewk_view);
69         Eina_Bool _set_ewk_view_options_listener(void);
70         Eina_Bool _set_user_agent(Evas_Object *ewk_view);
71         /* prefernece changed callback functions */
72         static void __preference_changed_cb(const char *key, void *data);
73         /* vconf changed callback functions */
74         static void __vconf_changed_cb(keynode_t *keynode, void *data);
75         Eina_Bool _set_http_accepted_language_header(Evas_Object *ewk_view);
76
77         /* Ecore timer callback functions */
78         static Eina_Bool __clean_up_windows_timer_cb(void *data);
79
80         Evas_Object *m_win;
81         Evas_Object *m_navi_bar;
82         Evas_Object *m_bg;
83
84         Browser_View *m_browser_view;
85         Browser_Window *m_focused_window;
86         Browser_User_Agent_DB *m_user_agent_db;
87         Browser_Policy_Decision_Maker *m_download_policy;
88         Browser_Geolocation *m_geolocation;
89         Browser_Network_Manager *m_network_manager;
90
91         std::vector<Browser_Window *> m_window_list;
92         Ecore_Timer *m_clean_up_windows_timer;
93 };
94 #endif /* BROWSER_CLASS_H */
95