| 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 string16 keyword = | 2178 std::wstring 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2996 | 2996 |
| 2997 // We want to use the user typed URL if available since that represents what | 2997 // We want to use the user typed URL if available since that represents what |
| 2998 // the user typed to get here, and fall back on the regular URL if not. | 2998 // the user typed to get here, and fall back on the regular URL if not. |
| 2999 if (!base_entry) | 2999 if (!base_entry) |
| 3000 return; | 3000 return; |
| 3001 GURL keyword_url = base_entry->user_typed_url().is_valid() ? | 3001 GURL keyword_url = base_entry->user_typed_url().is_valid() ? |
| 3002 base_entry->user_typed_url() : base_entry->url(); | 3002 base_entry->user_typed_url() : base_entry->url(); |
| 3003 if (!keyword_url.is_valid()) | 3003 if (!keyword_url.is_valid()) |
| 3004 return; | 3004 return; |
| 3005 | 3005 |
| 3006 string16 keyword = TemplateURLModel::GenerateKeyword( | 3006 std::wstring keyword = TemplateURLModel::GenerateKeyword( |
| 3007 keyword_url, | 3007 keyword_url, |
| 3008 provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER); | 3008 provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER); |
| 3009 | 3009 |
| 3010 // Download the OpenSearch description document. If this is successful, a | 3010 // Download the OpenSearch description document. If this is successful, a |
| 3011 // new keyword will be created when done. | 3011 // new keyword will be created when done. |
| 3012 profile()->GetTemplateURLFetcher()->ScheduleDownload( | 3012 profile()->GetTemplateURLFetcher()->ScheduleDownload( |
| 3013 keyword, | 3013 keyword, |
| 3014 url, | 3014 url, |
| 3015 base_entry->favicon().url(), | 3015 base_entry->favicon().url(), |
| 3016 new TemplateURLFetcherUICallbacks(this), | 3016 new TemplateURLFetcherUICallbacks(this), |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3378 } | 3378 } |
| 3379 | 3379 |
| 3380 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { | 3380 void TabContents::SwapInRenderViewHost(RenderViewHost* rvh) { |
| 3381 render_manager_.SwapInRenderViewHost(rvh); | 3381 render_manager_.SwapInRenderViewHost(rvh); |
| 3382 } | 3382 } |
| 3383 | 3383 |
| 3384 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 3384 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 3385 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); | 3385 RenderWidgetHostView* rwh_view = view()->CreateViewForWidget(rvh); |
| 3386 rwh_view->SetSize(view()->GetContainerSize()); | 3386 rwh_view->SetSize(view()->GetContainerSize()); |
| 3387 } | 3387 } |
| OLD | NEW |