OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/gfx/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 | 1128 |
1129 // Keep track of what the last search was across the tabs. | 1129 // Keep track of what the last search was across the tabs. |
1130 *last_search_prepopulate_text_ = find_text_; | 1130 *last_search_prepopulate_text_ = find_text_; |
1131 render_view_host()->StartFinding(current_find_request_id_, | 1131 render_view_host()->StartFinding(current_find_request_id_, |
1132 find_text_, | 1132 find_text_, |
1133 forward_direction, | 1133 forward_direction, |
1134 case_sensitive, | 1134 case_sensitive, |
1135 find_next); | 1135 find_next); |
1136 } | 1136 } |
1137 | 1137 |
1138 void TabContents::StopFinding(bool clear_selection) { | 1138 void TabContents::StopFinding( |
1139 // When |clear_selection| is true, it means the find string has been cleared | 1139 FindBarController::SelectionAction selection_action) { |
| 1140 // When the action is kClearAction, it means the find string has been cleared |
1140 // by the user, but the UI has not been dismissed. | 1141 // by the user, but the UI has not been dismissed. |
1141 if (!clear_selection) | 1142 if (selection_action != FindBarController::kClearSelection) |
1142 find_ui_active_ = false; | 1143 find_ui_active_ = false; |
1143 previous_find_text_ = find_text_; | 1144 previous_find_text_ = find_text_; |
1144 find_text_.clear(); | 1145 find_text_.clear(); |
1145 find_op_aborted_ = true; | 1146 find_op_aborted_ = true; |
1146 last_search_result_ = FindNotificationDetails(); | 1147 last_search_result_ = FindNotificationDetails(); |
1147 render_view_host()->StopFinding(clear_selection); | 1148 render_view_host()->StopFinding(selection_action); |
1148 } | 1149 } |
1149 | 1150 |
1150 void TabContents::OnSavePage() { | 1151 void TabContents::OnSavePage() { |
1151 // If we can not save the page, try to download it. | 1152 // If we can not save the page, try to download it. |
1152 if (!SavePackage::IsSavableContents(contents_mime_type())) { | 1153 if (!SavePackage::IsSavableContents(contents_mime_type())) { |
1153 DownloadManager* dlm = profile()->GetDownloadManager(); | 1154 DownloadManager* dlm = profile()->GetDownloadManager(); |
1154 const GURL& current_page_url = GetURL(); | 1155 const GURL& current_page_url = GetURL(); |
1155 if (dlm && current_page_url.is_valid()) | 1156 if (dlm && current_page_url.is_valid()) |
1156 dlm->DownloadUrl(current_page_url, GURL(), "", this); | 1157 dlm->DownloadUrl(current_page_url, GURL(), "", this); |
1157 return; | 1158 return; |
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2863 } | 2864 } |
2864 | 2865 |
2865 void TabContents::set_encoding(const std::string& encoding) { | 2866 void TabContents::set_encoding(const std::string& encoding) { |
2866 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); | 2867 encoding_ = CharacterEncoding::GetCanonicalEncodingNameByAliasName(encoding); |
2867 } | 2868 } |
2868 | 2869 |
2869 void TabContents::SetAppIcon(const SkBitmap& app_icon) { | 2870 void TabContents::SetAppIcon(const SkBitmap& app_icon) { |
2870 app_icon_ = app_icon; | 2871 app_icon_ = app_icon; |
2871 NotifyNavigationStateChanged(INVALIDATE_TITLE); | 2872 NotifyNavigationStateChanged(INVALIDATE_TITLE); |
2872 } | 2873 } |
OLD | NEW |