Chromium Code Reviews

Side by Side Diff: chrome/browser/tab_contents/tab_contents.h

Issue 504051: Relanding the language detection. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
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"
21 #include "chrome/browser/dom_ui/dom_ui_factory.h" 22 #include "chrome/browser/dom_ui/dom_ui_factory.h"
22 #include "chrome/browser/download/save_package.h" 23 #include "chrome/browser/download/save_package.h"
23 #include "chrome/browser/fav_icon_helper.h" 24 #include "chrome/browser/fav_icon_helper.h"
24 #include "chrome/browser/find_notification_details.h" 25 #include "chrome/browser/find_notification_details.h"
25 #include "chrome/browser/jsmessage_box_client.h" 26 #include "chrome/browser/jsmessage_box_client.h"
26 #include "chrome/browser/net/url_request_context_getter.h" 27 #include "chrome/browser/net/url_request_context_getter.h"
27 #include "chrome/browser/shell_dialogs.h" 28 #include "chrome/browser/shell_dialogs.h"
28 #include "chrome/browser/renderer_host/render_view_host_delegate.h" 29 #include "chrome/browser/renderer_host/render_view_host_delegate.h"
29 #include "chrome/browser/tab_contents/constrained_window.h" 30 #include "chrome/browser/tab_contents/constrained_window.h"
30 #include "chrome/browser/tab_contents/infobar_delegate.h" 31 #include "chrome/browser/tab_contents/infobar_delegate.h"
(...skipping 250 matching lines...)
281 virtual void DidBecomeSelected(); 282 virtual void DidBecomeSelected();
282 283
283 // Invoked when the tab contents becomes hidden. 284 // Invoked when the tab contents becomes hidden.
284 // NOTE: If you override this, call the superclass version too! 285 // NOTE: If you override this, call the superclass version too!
285 virtual void WasHidden(); 286 virtual void WasHidden();
286 287
287 // Activates this contents within its containing window, bringing that window 288 // Activates this contents within its containing window, bringing that window
288 // to the foreground if necessary. 289 // to the foreground if necessary.
289 void Activate(); 290 void Activate();
290 291
292 // Called by CLDHelper to notify the language of a page has been detected.
293 void PageLanguageDetected();
294
291 // TODO(brettw) document these. 295 // TODO(brettw) document these.
292 virtual void ShowContents(); 296 virtual void ShowContents();
293 virtual void HideContents(); 297 virtual void HideContents();
294 298
295 // Commands ------------------------------------------------------------------ 299 // Commands ------------------------------------------------------------------
296 300
297 // Implementation of PageNavigator. 301 // Implementation of PageNavigator.
298 virtual void OpenURL(const GURL& url, const GURL& referrer, 302 virtual void OpenURL(const GURL& url, const GURL& referrer,
299 WindowOpenDisposition disposition, 303 WindowOpenDisposition disposition,
300 PageTransition::Type transition); 304 PageTransition::Type transition);
(...skipping 230 matching lines...)
531 // string entered, whatever tab that search was performed in. 535 // string entered, whatever tab that search was performed in.
532 string16 find_prepopulate_text() const { 536 string16 find_prepopulate_text() const {
533 return *last_search_prepopulate_text_; 537 return *last_search_prepopulate_text_;
534 } 538 }
535 539
536 // Accessor for find_result_. 540 // Accessor for find_result_.
537 const FindNotificationDetails& find_result() const { 541 const FindNotificationDetails& find_result() const {
538 return last_search_result_; 542 return last_search_result_;
539 } 543 }
540 544
541 // Get the most probable language of the text content in the tab.
542 void GetPageLanguage();
543
544 // Misc state & callbacks ---------------------------------------------------- 545 // Misc state & callbacks ----------------------------------------------------
545 546
546 // Set whether the contents should block javascript message boxes or not. 547 // Set whether the contents should block javascript message boxes or not.
547 // Default is not to block any message boxes. 548 // Default is not to block any message boxes.
548 void set_suppress_javascript_messages(bool suppress_javascript_messages) { 549 void set_suppress_javascript_messages(bool suppress_javascript_messages) {
549 suppress_javascript_messages_ = suppress_javascript_messages; 550 suppress_javascript_messages_ = suppress_javascript_messages;
550 } 551 }
551 552
552 // Prepare for saving the current web page to disk. 553 // Prepare for saving the current web page to disk.
553 void OnSavePage(); 554 void OnSavePage();
(...skipping 253 matching lines...)
807 bool final_update); 808 bool final_update);
808 virtual void GoToEntryAtOffset(int offset); 809 virtual void GoToEntryAtOffset(int offset);
809 virtual void GetHistoryListCount(int* back_list_count, 810 virtual void GetHistoryListCount(int* back_list_count,
810 int* forward_list_count); 811 int* forward_list_count);
811 virtual void OnMissingPluginStatus(int status); 812 virtual void OnMissingPluginStatus(int status);
812 virtual void OnCrashedPlugin(const FilePath& plugin_path); 813 virtual void OnCrashedPlugin(const FilePath& plugin_path);
813 virtual void OnCrashedWorker(); 814 virtual void OnCrashedWorker();
814 virtual void OnDidGetApplicationInfo( 815 virtual void OnDidGetApplicationInfo(
815 int32 page_id, 816 int32 page_id,
816 const webkit_glue::WebApplicationInfo& info); 817 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);
817 822
818 // RenderViewHostDelegate::Resource implementation. 823 // RenderViewHostDelegate::Resource implementation.
819 virtual void DidStartProvisionalLoadForFrame(RenderViewHost* render_view_host, 824 virtual void DidStartProvisionalLoadForFrame(RenderViewHost* render_view_host,
820 bool is_main_frame, 825 bool is_main_frame,
821 const GURL& url); 826 const GURL& url);
822 virtual void DidStartReceivingResourceResponse( 827 virtual void DidStartReceivingResourceResponse(
823 ResourceRequestDetails* details); 828 ResourceRequestDetails* details);
824 virtual void DidRedirectProvisionalLoad(int32 page_id, 829 virtual void DidRedirectProvisionalLoad(int32 page_id,
825 const GURL& source_url, 830 const GURL& source_url,
826 const GURL& target_url); 831 const GURL& target_url);
(...skipping 344 matching lines...)
1171 base::TimeTicks new_tab_start_time_; 1176 base::TimeTicks new_tab_start_time_;
1172 1177
1173 // The time that we started to close the tab. 1178 // The time that we started to close the tab.
1174 base::TimeTicks tab_close_start_time_; 1179 base::TimeTicks tab_close_start_time_;
1175 1180
1176 // Contextual information to be used for requests created here. 1181 // Contextual information to be used for requests created here.
1177 // Can be NULL in which case we defer to the request context from the 1182 // Can be NULL in which case we defer to the request context from the
1178 // profile 1183 // profile
1179 scoped_refptr<URLRequestContextGetter> request_context_; 1184 scoped_refptr<URLRequestContextGetter> request_context_;
1180 1185
1186 // Used to retrieve the language of the current page.
1187 scoped_refptr<CLDHelper> cld_helper_;
1188
1181 // --------------------------------------------------------------------------- 1189 // ---------------------------------------------------------------------------
1182 1190
1183 DISALLOW_COPY_AND_ASSIGN(TabContents); 1191 DISALLOW_COPY_AND_ASSIGN(TabContents);
1184 }; 1192 };
1185 1193
1186 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_ 1194 #endif // CHROME_BROWSER_TAB_CONTENTS_TAB_CONTENTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/navigation_entry.h ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine