| 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/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 browser::NavigateParams params(this, url, location_bar->GetPageTransition()); | 1301 browser::NavigateParams params(this, url, location_bar->GetPageTransition()); |
| 1302 params.disposition = open_disposition; | 1302 params.disposition = open_disposition; |
| 1303 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least | 1303 // Use ADD_INHERIT_OPENER so that all pages opened by the omnibox at least |
| 1304 // inherit the opener. In some cases the tabstrip will determine the group | 1304 // inherit the opener. In some cases the tabstrip will determine the group |
| 1305 // should be inherited, in which case the group is inherited instead of the | 1305 // should be inherited, in which case the group is inherited instead of the |
| 1306 // opener. | 1306 // opener. |
| 1307 params.tabstrip_add_types = | 1307 params.tabstrip_add_types = |
| 1308 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; | 1308 TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; |
| 1309 browser::Navigate(¶ms); | 1309 browser::Navigate(¶ms); |
| 1310 | 1310 |
| 1311 // TODO: the ExtensionService should never be NULL, but in some cases it is, | 1311 DCHECK(profile_->GetExtensionService()); |
| 1312 // see bug 73768. After it is resolved, the explicit test can go away. | 1312 if (profile_->GetExtensionService()->IsInstalledApp(url)) { |
| 1313 ExtensionService* service = profile_->GetExtensionService(); | |
| 1314 if (service && service->IsInstalledApp(url)) { | |
| 1315 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, | 1313 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, |
| 1316 extension_misc::APP_LAUNCH_OMNIBOX_LOCATION, | 1314 extension_misc::APP_LAUNCH_OMNIBOX_LOCATION, |
| 1317 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | 1315 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); |
| 1318 } | 1316 } |
| 1319 } | 1317 } |
| 1320 | 1318 |
| 1321 void Browser::Stop() { | 1319 void Browser::Stop() { |
| 1322 UserMetrics::RecordAction(UserMetricsAction("Stop"), profile_); | 1320 UserMetrics::RecordAction(UserMetricsAction("Stop"), profile_); |
| 1323 GetSelectedTabContentsWrapper()->tab_contents()->Stop(); | 1321 GetSelectedTabContentsWrapper()->tab_contents()->Stop(); |
| 1324 } | 1322 } |
| (...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3510 preview_contents->controller().CopyStateFromAndPrune( | 3508 preview_contents->controller().CopyStateFromAndPrune( |
| 3511 &tab_contents->controller()); | 3509 &tab_contents->controller()); |
| 3512 // TabStripModel takes ownership of preview_contents. | 3510 // TabStripModel takes ownership of preview_contents. |
| 3513 TabContentsWrapper* old_contents = | 3511 TabContentsWrapper* old_contents = |
| 3514 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt( | 3512 tab_handler_->GetTabStripModel()->ReplaceTabContentsAt( |
| 3515 index, preview_contents); | 3513 index, preview_contents); |
| 3516 // InstantUnloadHandler takes ownership of old_contents. | 3514 // InstantUnloadHandler takes ownership of old_contents. |
| 3517 instant_unload_handler_->RunUnloadListenersOrDestroy(old_contents, index); | 3515 instant_unload_handler_->RunUnloadListenersOrDestroy(old_contents, index); |
| 3518 | 3516 |
| 3519 GURL url = preview_contents->tab_contents()->GetURL(); | 3517 GURL url = preview_contents->tab_contents()->GetURL(); |
| 3520 // TODO: the ExtensionService should never be NULL, but in some cases it is, | 3518 DCHECK(profile_->GetExtensionService()); |
| 3521 // see bug 73768. After it is resolved, the explicit test can go away. | 3519 if (profile_->GetExtensionService()->IsInstalledApp(url)) { |
| 3522 ExtensionService* service = profile_->GetExtensionService(); | |
| 3523 if (service && service->IsInstalledApp(url)) { | |
| 3524 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, | 3520 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, |
| 3525 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT, | 3521 extension_misc::APP_LAUNCH_OMNIBOX_INSTANT, |
| 3526 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); | 3522 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); |
| 3527 } | 3523 } |
| 3528 } | 3524 } |
| 3529 | 3525 |
| 3530 void Browser::SetSuggestedText(const string16& text) { | 3526 void Browser::SetSuggestedText(const string16& text) { |
| 3531 window()->GetLocationBar()->SetSuggestedText(text); | 3527 window()->GetLocationBar()->SetSuggestedText(text); |
| 3532 } | 3528 } |
| 3533 | 3529 |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4391 // The page transition below is only for the purpose of inserting the tab. | 4387 // The page transition below is only for the purpose of inserting the tab. |
| 4392 browser->AddTab(view_source_contents, PageTransition::LINK); | 4388 browser->AddTab(view_source_contents, PageTransition::LINK); |
| 4393 } | 4389 } |
| 4394 | 4390 |
| 4395 if (profile_->HasSessionService()) { | 4391 if (profile_->HasSessionService()) { |
| 4396 SessionService* session_service = profile_->GetSessionService(); | 4392 SessionService* session_service = profile_->GetSessionService(); |
| 4397 if (session_service) | 4393 if (session_service) |
| 4398 session_service->TabRestored(&view_source_contents->controller(), false); | 4394 session_service->TabRestored(&view_source_contents->controller(), false); |
| 4399 } | 4395 } |
| 4400 } | 4396 } |
| OLD | NEW |