| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_TAB_CONTENTS_TAB_CONTENTS_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "app/gfx/native_widget_types.h" | 15 #include "app/gfx/native_widget_types.h" |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/gfx/rect.h" | 17 #include "base/gfx/rect.h" |
| 18 #include "base/scoped_ptr.h" | 18 #include "base/scoped_ptr.h" |
| 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 19 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 20 #include "chrome/browser/cancelable_request.h" | 20 #include "chrome/browser/cancelable_request.h" |
| 21 #include "chrome/browser/cld_helper.h" | |
| 22 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 21 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
| 23 #include "chrome/browser/download/save_package.h" | 22 #include "chrome/browser/download/save_package.h" |
| 24 #include "chrome/browser/fav_icon_helper.h" | 23 #include "chrome/browser/fav_icon_helper.h" |
| 25 #include "chrome/browser/find_notification_details.h" | 24 #include "chrome/browser/find_notification_details.h" |
| 26 #include "chrome/browser/jsmessage_box_client.h" | 25 #include "chrome/browser/jsmessage_box_client.h" |
| 27 #include "chrome/browser/net/url_request_context_getter.h" | 26 #include "chrome/browser/net/url_request_context_getter.h" |
| 28 #include "chrome/browser/shell_dialogs.h" | 27 #include "chrome/browser/shell_dialogs.h" |
| 29 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 28 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 30 #include "chrome/browser/tab_contents/constrained_window.h" | 29 #include "chrome/browser/tab_contents/constrained_window.h" |
| 31 #include "chrome/browser/tab_contents/infobar_delegate.h" | 30 #include "chrome/browser/tab_contents/infobar_delegate.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 virtual void DidBecomeSelected(); | 281 virtual void DidBecomeSelected(); |
| 283 | 282 |
| 284 // Invoked when the tab contents becomes hidden. | 283 // Invoked when the tab contents becomes hidden. |
| 285 // NOTE: If you override this, call the superclass version too! | 284 // NOTE: If you override this, call the superclass version too! |
| 286 virtual void WasHidden(); | 285 virtual void WasHidden(); |
| 287 | 286 |
| 288 // Activates this contents within its containing window, bringing that window | 287 // Activates this contents within its containing window, bringing that window |
| 289 // to the foreground if necessary. | 288 // to the foreground if necessary. |
| 290 void Activate(); | 289 void Activate(); |
| 291 | 290 |
| 292 // Called by CLDHelper to notify the language of a page has been detected. | |
| 293 void PageLanguageDetected(); | |
| 294 | |
| 295 // TODO(brettw) document these. | 291 // TODO(brettw) document these. |
| 296 virtual void ShowContents(); | 292 virtual void ShowContents(); |
| 297 virtual void HideContents(); | 293 virtual void HideContents(); |
| 298 | 294 |
| 299 // Commands ------------------------------------------------------------------ | 295 // Commands ------------------------------------------------------------------ |
| 300 | 296 |
| 301 // Implementation of PageNavigator. | 297 // Implementation of PageNavigator. |
| 302 virtual void OpenURL(const GURL& url, const GURL& referrer, | 298 virtual void OpenURL(const GURL& url, const GURL& referrer, |
| 303 WindowOpenDisposition disposition, | 299 WindowOpenDisposition disposition, |
| 304 PageTransition::Type transition); | 300 PageTransition::Type transition); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // string entered, whatever tab that search was performed in. | 531 // string entered, whatever tab that search was performed in. |
| 536 string16 find_prepopulate_text() const { | 532 string16 find_prepopulate_text() const { |
| 537 return *last_search_prepopulate_text_; | 533 return *last_search_prepopulate_text_; |
| 538 } | 534 } |
| 539 | 535 |
| 540 // Accessor for find_result_. | 536 // Accessor for find_result_. |
| 541 const FindNotificationDetails& find_result() const { | 537 const FindNotificationDetails& find_result() const { |
| 542 return last_search_result_; | 538 return last_search_result_; |
| 543 } | 539 } |
| 544 | 540 |
| 541 // Get the most probable language of the text content in the tab. |
| 542 void GetPageLanguage(); |
| 543 |
| 545 // Misc state & callbacks ---------------------------------------------------- | 544 // Misc state & callbacks ---------------------------------------------------- |
| 546 | 545 |
| 547 // Set whether the contents should block javascript message boxes or not. | 546 // Set whether the contents should block javascript message boxes or not. |
| 548 // Default is not to block any message boxes. | 547 // Default is not to block any message boxes. |
| 549 void set_suppress_javascript_messages(bool suppress_javascript_messages) { | 548 void set_suppress_javascript_messages(bool suppress_javascript_messages) { |
| 550 suppress_javascript_messages_ = suppress_javascript_messages; | 549 suppress_javascript_messages_ = suppress_javascript_messages; |
| 551 } | 550 } |
| 552 | 551 |
| 553 // Prepare for saving the current web page to disk. | 552 // Prepare for saving the current web page to disk. |
| 554 void OnSavePage(); | 553 void OnSavePage(); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 bool final_update); | 807 bool final_update); |
| 809 virtual void GoToEntryAtOffset(int offset); | 808 virtual void GoToEntryAtOffset(int offset); |
| 810 virtual void GetHistoryListCount(int* back_list_count, | 809 virtual void GetHistoryListCount(int* back_list_count, |
| 811 int* forward_list_count); | 810 int* forward_list_count); |
| 812 virtual void OnMissingPluginStatus(int status); | 811 virtual void OnMissingPluginStatus(int status); |
| 813 virtual void OnCrashedPlugin(const FilePath& plugin_path); | 812 virtual void OnCrashedPlugin(const FilePath& plugin_path); |
| 814 virtual void OnCrashedWorker(); | 813 virtual void OnCrashedWorker(); |
| 815 virtual void OnDidGetApplicationInfo( | 814 virtual void OnDidGetApplicationInfo( |
| 816 int32 page_id, | 815 int32 page_id, |
| 817 const webkit_glue::WebApplicationInfo& info); | 816 const webkit_glue::WebApplicationInfo& info); |
| 818 virtual void OnPageContents(const GURL& url, | |
| 819 int renderer_process_id, | |
| 820 int32 page_id, | |
| 821 const std::wstring& contents); | |
| 822 | 817 |
| 823 // RenderViewHostDelegate::Resource implementation. | 818 // RenderViewHostDelegate::Resource implementation. |
| 824 virtual void DidStartProvisionalLoadForFrame(RenderViewHost* render_view_host, | 819 virtual void DidStartProvisionalLoadForFrame(RenderViewHost* render_view_host, |
| 825 bool is_main_frame, | 820 bool is_main_frame, |
| 826 const GURL& url); | 821 const GURL& url); |
| 827 virtual void DidStartReceivingResourceResponse( | 822 virtual void DidStartReceivingResourceResponse( |
| 828 ResourceRequestDetails* details); | 823 ResourceRequestDetails* details); |
| 829 virtual void DidRedirectProvisionalLoad(int32 page_id, | 824 virtual void DidRedirectProvisionalLoad(int32 page_id, |
| 830 const GURL& source_url, | 825 const GURL& source_url, |
| 831 const GURL& target_url); | 826 const GURL& target_url); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 base::TimeTicks new_tab_start_time_; | 1171 base::TimeTicks new_tab_start_time_; |
| 1177 | 1172 |
| 1178 // The time that we started to close the tab. | 1173 // The time that we started to close the tab. |
| 1179 base::TimeTicks tab_close_start_time_; | 1174 base::TimeTicks tab_close_start_time_; |
| 1180 | 1175 |
| 1181 // Contextual information to be used for requests created here. | 1176 // Contextual information to be used for requests created here. |
| 1182 // Can be NULL in which case we defer to the request context from the | 1177 // Can be NULL in which case we defer to the request context from the |
| 1183 // profile | 1178 // profile |
| 1184 scoped_refptr<URLRequestContextGetter> request_context_; | 1179 scoped_refptr<URLRequestContextGetter> request_context_; |
| 1185 | 1180 |
| 1186 // Used to retrieve the language of the current page. | |
| 1187 scoped_refptr<CLDHelper> cld_helper_; | |
| 1188 | |
| 1189 // --------------------------------------------------------------------------- | 1181 // --------------------------------------------------------------------------- |
| 1190 | 1182 |
| 1191 DISALLOW_COPY_AND_ASSIGN(TabContents); | 1183 DISALLOW_COPY_AND_ASSIGN(TabContents); |
| 1192 }; | 1184 }; |
| 1193 | 1185 |
| 1194 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ | 1186 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ |
| OLD | NEW |