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 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 const NavigationEntry* previous_entry = | 2168 const NavigationEntry* previous_entry = |
2169 controller_.GetEntryAtIndex(last_index - 1); | 2169 controller_.GetEntryAtIndex(last_index - 1); |
2170 if (IsFormSubmit(previous_entry)) { | 2170 if (IsFormSubmit(previous_entry)) { |
2171 // Only generate a keyword if the previous page wasn't itself a form | 2171 // Only generate a keyword if the previous page wasn't itself a form |
2172 // submit. | 2172 // submit. |
2173 return; | 2173 return; |
2174 } | 2174 } |
2175 | 2175 |
2176 GURL keyword_url = previous_entry->user_typed_url().is_valid() ? | 2176 GURL keyword_url = previous_entry->user_typed_url().is_valid() ? |
2177 previous_entry->user_typed_url() : previous_entry->url(); | 2177 previous_entry->user_typed_url() : previous_entry->url(); |
2178 std::wstring keyword = | 2178 string16 keyword = |
2179 TemplateURLModel::GenerateKeyword(keyword_url, true); // autodetected | 2179 TemplateURLModel::GenerateKeyword(keyword_url, true); // autodetected |
2180 if (keyword.empty()) | 2180 if (keyword.empty()) |
2181 return; | 2181 return; |
2182 | 2182 |
2183 TemplateURLModel* url_model = profile()->GetTemplateURLModel(); | 2183 TemplateURLModel* url_model = profile()->GetTemplateURLModel(); |
2184 if (!url_model) | 2184 if (!url_model) |
2185 return; | 2185 return; |
2186 | 2186 |
2187 if (!url_model->loaded()) { | 2187 if (!url_model->loaded()) { |
2188 url_model->Load(); | 2188 url_model->Load(); |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2989 | 2989 |
2990 // We want to use the user typed URL if available since that represents what | 2990 // We want to use the user typed URL if available since that represents what |
2991 // the user typed to get here, and fall back on the regular URL if not. | 2991 // the user typed to get here, and fall back on the regular URL if not. |
2992 if (!base_entry) | 2992 if (!base_entry) |
2993 return; | 2993 return; |
2994 GURL keyword_url = base_entry->user_typed_url().is_valid() ? | 2994 GURL keyword_url = base_entry->user_typed_url().is_valid() ? |
2995 base_entry->user_typed_url() : base_entry->url(); | 2995 base_entry->user_typed_url() : base_entry->url(); |
2996 if (!keyword_url.is_valid()) | 2996 if (!keyword_url.is_valid()) |
2997 return; | 2997 return; |
2998 | 2998 |
2999 std::wstring keyword = TemplateURLModel::GenerateKeyword( | 2999 string16 keyword = TemplateURLModel::GenerateKeyword( |
3000 keyword_url, | 3000 keyword_url, |
3001 provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER); | 3001 provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER); |
3002 | 3002 |
3003 // Download the OpenSearch description document. If this is successful, a | 3003 // Download the OpenSearch description document. If this is successful, a |
3004 // new keyword will be created when done. | 3004 // new keyword will be created when done. |
3005 profile()->GetTemplateURLFetcher()->ScheduleDownload( | 3005 profile()->GetTemplateURLFetcher()->ScheduleDownload( |
3006 keyword, | 3006 keyword, |
3007 url, | 3007 url, |
3008 base_entry->favicon().url(), | 3008 base_entry->favicon().url(), |
3009 new TemplateURLFetcherUICallbacks(this), | 3009 new TemplateURLFetcherUICallbacks(this), |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3371 } | 3371 } |
3372 | 3372 |
3373 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3373 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
3374 render_manager_.SwapInRenderViewHost(rvh); | 3374 render_manager_.SwapInRenderViewHost(rvh); |
3375 } | 3375 } |
3376 | 3376 |
3377 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3377 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
3378 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3378 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
3379 rwh_view->SetSize(view()->GetContainerSize()); | 3379 rwh_view->SetSize(view()->GetContainerSize()); |
3380 } | 3380 } |
OLD | NEW |