OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #include "chrome/browser/search_engines/template_url_fetcher_ui_callbacks.h" | 68 #include "chrome/browser/search_engines/template_url_fetcher_ui_callbacks.h" |
69 #include "chrome/browser/search_engines/template_url_model.h" | 69 #include "chrome/browser/search_engines/template_url_model.h" |
70 #include "chrome/browser/sessions/session_types.h" | 70 #include "chrome/browser/sessions/session_types.h" |
71 #include "chrome/browser/tab_contents/infobar_delegate.h" | 71 #include "chrome/browser/tab_contents/infobar_delegate.h" |
72 #include "chrome/browser/tab_contents/interstitial_page.h" | 72 #include "chrome/browser/tab_contents/interstitial_page.h" |
73 #include "chrome/browser/tab_contents/navigation_entry.h" | 73 #include "chrome/browser/tab_contents/navigation_entry.h" |
74 #include "chrome/browser/tab_contents/provisional_load_details.h" | 74 #include "chrome/browser/tab_contents/provisional_load_details.h" |
75 #include "chrome/browser/tab_contents/tab_contents_delegate.h" | 75 #include "chrome/browser/tab_contents/tab_contents_delegate.h" |
76 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" | 76 #include "chrome/browser/tab_contents/tab_contents_ssl_helper.h" |
77 #include "chrome/browser/tab_contents/tab_contents_view.h" | 77 #include "chrome/browser/tab_contents/tab_contents_view.h" |
| 78 #include "chrome/browser/tab_contents/thumbnail_generator.h" |
78 #include "chrome/browser/tab_contents/web_navigation_observer.h" | 79 #include "chrome/browser/tab_contents/web_navigation_observer.h" |
79 #include "chrome/browser/translate/page_translated_details.h" | 80 #include "chrome/browser/translate/page_translated_details.h" |
80 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" | 81 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
81 #include "chrome/browser/ui/find_bar/find_bar_state.h" | 82 #include "chrome/browser/ui/find_bar/find_bar_state.h" |
82 #include "chrome/common/bindings_policy.h" | 83 #include "chrome/common/bindings_policy.h" |
83 #include "chrome/common/chrome_switches.h" | 84 #include "chrome/common/chrome_switches.h" |
84 #include "chrome/common/content_restriction.h" | 85 #include "chrome/common/content_restriction.h" |
85 #include "chrome/common/extensions/extension.h" | 86 #include "chrome/common/extensions/extension.h" |
86 #include "chrome/common/extensions/extension_action.h" | 87 #include "chrome/common/extensions/extension_action.h" |
87 #include "chrome/common/extensions/extension_icon_set.h" | 88 #include "chrome/common/extensions/extension_icon_set.h" |
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 } | 2372 } |
2372 #endif | 2373 #endif |
2373 | 2374 |
2374 language_state_.LanguageDetermined(language, page_translatable); | 2375 language_state_.LanguageDetermined(language, page_translatable); |
2375 | 2376 |
2376 std::string lang = language; | 2377 std::string lang = language; |
2377 NotificationService::current()->Notify( | 2378 NotificationService::current()->Notify( |
2378 NotificationType::TAB_LANGUAGE_DETERMINED, | 2379 NotificationType::TAB_LANGUAGE_DETERMINED, |
2379 Source<TabContents>(this), | 2380 Source<TabContents>(this), |
2380 Details<std::string>(&lang)); | 2381 Details<std::string>(&lang)); |
| 2382 |
| 2383 // Generate the thumbnail here if the in-browser thumbnailing is enabled. |
| 2384 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 2385 switches::kEnableInBrowserThumbnailing)) { |
| 2386 ThumbnailGenerator::UpdateThumbnailIfNecessary(this, url); |
| 2387 } |
2381 } | 2388 } |
2382 | 2389 |
2383 void TabContents::OnPageTranslated(int32 page_id, | 2390 void TabContents::OnPageTranslated(int32 page_id, |
2384 const std::string& original_lang, | 2391 const std::string& original_lang, |
2385 const std::string& translated_lang, | 2392 const std::string& translated_lang, |
2386 TranslateErrors::Type error_type) { | 2393 TranslateErrors::Type error_type) { |
2387 language_state_.set_current_language(translated_lang); | 2394 language_state_.set_current_language(translated_lang); |
2388 language_state_.set_translation_pending(false); | 2395 language_state_.set_translation_pending(false); |
2389 PageTranslatedDetails details(original_lang, translated_lang, error_type); | 2396 PageTranslatedDetails details(original_lang, translated_lang, error_type); |
2390 NotificationService::current()->Notify( | 2397 NotificationService::current()->Notify( |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3386 if (pm != NULL) { | 3393 if (pm != NULL) { |
3387 if (pm->MaybeUsePreloadedPage(this, url)) { | 3394 if (pm->MaybeUsePreloadedPage(this, url)) { |
3388 // TODO(tburkard): If the preloaded page has not finished preloading | 3395 // TODO(tburkard): If the preloaded page has not finished preloading |
3389 // yet, we should not do this. | 3396 // yet, we should not do this. |
3390 DidStopLoading(); | 3397 DidStopLoading(); |
3391 return true; | 3398 return true; |
3392 } | 3399 } |
3393 } | 3400 } |
3394 return false; | 3401 return false; |
3395 } | 3402 } |
OLD | NEW |