OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 content::RecordAction(UserMetricsAction("Home")); | 439 content::RecordAction(UserMetricsAction("Home")); |
440 | 440 |
441 std::string extra_headers; | 441 std::string extra_headers; |
442 #if defined(ENABLE_RLZ) && !defined(OS_IOS) | 442 #if defined(ENABLE_RLZ) && !defined(OS_IOS) |
443 // If the home page is a Google home page, add the RLZ header to the request. | 443 // If the home page is a Google home page, add the RLZ header to the request. |
444 PrefService* pref_service = browser->profile()->GetPrefs(); | 444 PrefService* pref_service = browser->profile()->GetPrefs(); |
445 if (pref_service) { | 445 if (pref_service) { |
446 if (google_util::IsGoogleHomePageUrl( | 446 if (google_util::IsGoogleHomePageUrl( |
447 GURL(pref_service->GetString(prefs::kHomePage)))) { | 447 GURL(pref_service->GetString(prefs::kHomePage)))) { |
448 extra_headers = RLZTracker::GetAccessPointHttpHeader( | 448 extra_headers = RLZTracker::GetAccessPointHttpHeader( |
449 RLZTracker::CHROME_HOME_PAGE); | 449 RLZTracker::ChromeHomePage()); |
450 } | 450 } |
451 } | 451 } |
452 #endif // defined(ENABLE_RLZ) && !defined(OS_IOS) | 452 #endif // defined(ENABLE_RLZ) && !defined(OS_IOS) |
453 | 453 |
454 GURL url = browser->profile()->GetHomePage(); | 454 GURL url = browser->profile()->GetHomePage(); |
455 | 455 |
456 // Streamlined hosted apps should return to their launch page when the home | 456 // Streamlined hosted apps should return to their launch page when the home |
457 // button is pressed. | 457 // button is pressed. |
458 if (browser->is_app()) { | 458 if (browser->is_app()) { |
459 const extensions::Extension* extension = | 459 const extensions::Extension* extension = |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 | 728 |
729 case extensions::CommandService::BROWSER_ACTION: | 729 case extensions::CommandService::BROWSER_ACTION: |
730 // BookmarkCurrentPage is called through a user gesture, so it is safe | 730 // BookmarkCurrentPage is called through a user gesture, so it is safe |
731 // to call ShowBrowserActionPopup. | 731 // to call ShowBrowserActionPopup. |
732 browser->window()->ShowBrowserActionPopup(extension); | 732 browser->window()->ShowBrowserActionPopup(extension); |
733 return; | 733 return; |
734 | 734 |
735 case extensions::CommandService::PAGE_ACTION: | 735 case extensions::CommandService::PAGE_ACTION: |
736 browser->window()->ShowPageActionPopup(extension); | 736 browser->window()->ShowPageActionPopup(extension); |
737 return; | 737 return; |
738 }; | 738 } |
739 } | 739 } |
740 | 740 |
741 BookmarkCurrentPageInternal(browser); | 741 BookmarkCurrentPageInternal(browser); |
742 } | 742 } |
743 | 743 |
744 bool CanBookmarkCurrentPage(const Browser* browser) { | 744 bool CanBookmarkCurrentPage(const Browser* browser) { |
745 return CanBookmarkCurrentPageInternal(browser, true); | 745 return CanBookmarkCurrentPageInternal(browser, true); |
746 } | 746 } |
747 | 747 |
748 void BookmarkAllTabs(Browser* browser) { | 748 void BookmarkAllTabs(Browser* browser) { |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 browser->profile(), | 1257 browser->profile(), |
1258 browser->host_desktop_type())); | 1258 browser->host_desktop_type())); |
1259 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1259 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1260 | 1260 |
1261 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1261 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1262 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1262 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1263 app_browser->window()->Show(); | 1263 app_browser->window()->Show(); |
1264 } | 1264 } |
1265 | 1265 |
1266 } // namespace chrome | 1266 } // namespace chrome |
OLD | NEW |