Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 9443007: Add Chrome To Mobile Service and Views Page Action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put shared CloudPrint consts/helpers in chrome/common/; use CloudPrintURL. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 if (!was_bookmarked && profile_->IsOffTheRecord()) { 1941 if (!was_bookmarked && profile_->IsOffTheRecord()) {
1942 // If we're incognito the favicon may not have been saved. Save it now 1942 // If we're incognito the favicon may not have been saved. Save it now
1943 // so that bookmarks have an icon for the page. 1943 // so that bookmarks have an icon for the page.
1944 tab->favicon_tab_helper()->SaveFavicon(); 1944 tab->favicon_tab_helper()->SaveFavicon();
1945 } 1945 }
1946 bookmark_utils::AddIfNotBookmarked(model, url, title); 1946 bookmark_utils::AddIfNotBookmarked(model, url, title);
1947 // Make sure the model actually added a bookmark before showing the star. A 1947 // Make sure the model actually added a bookmark before showing the star. A
1948 // bookmark isn't created if the url is invalid. 1948 // bookmark isn't created if the url is invalid.
1949 if (window_->IsActive() && model->IsBookmarked(url)) { 1949 if (window_->IsActive() && model->IsBookmarked(url)) {
1950 // Only show the bubble if the window is active, otherwise we may get into 1950 // Only show the bubble if the window is active, otherwise we may get into
1951 // weird situations were the bubble is deleted as soon as it is shown. 1951 // weird situations where the bubble is deleted as soon as it is shown.
1952 window_->ShowBookmarkBubble(url, was_bookmarked); 1952 window_->ShowBookmarkBubble(url, was_bookmarked);
1953 } 1953 }
1954 } 1954 }
1955 1955
1956 void Browser::SavePage() { 1956 void Browser::SavePage() {
1957 content::RecordAction(UserMetricsAction("SavePage")); 1957 content::RecordAction(UserMetricsAction("SavePage"));
1958 WebContents* current_tab = GetSelectedWebContents(); 1958 WebContents* current_tab = GetSelectedWebContents();
1959 if (current_tab && current_tab->GetContentsMimeType() == "application/pdf") 1959 if (current_tab && current_tab->GetContentsMimeType() == "application/pdf")
1960 content::RecordAction(UserMetricsAction("PDF.SavePage")); 1960 content::RecordAction(UserMetricsAction("PDF.SavePage"));
1961 GetSelectedWebContents()->OnSavePage(); 1961 GetSelectedWebContents()->OnSavePage();
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 #endif 3027 #endif
3028 3028
3029 // Page-related commands 3029 // Page-related commands
3030 case IDC_SAVE_PAGE: SavePage(); break; 3030 case IDC_SAVE_PAGE: SavePage(); break;
3031 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break; 3031 case IDC_BOOKMARK_PAGE: BookmarkCurrentPage(); break;
3032 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break; 3032 case IDC_BOOKMARK_ALL_TABS: BookmarkAllTabs(); break;
3033 case IDC_VIEW_SOURCE: ViewSelectedSource(); break; 3033 case IDC_VIEW_SOURCE: ViewSelectedSource(); break;
3034 case IDC_EMAIL_PAGE_LOCATION: EmailPageLocation(); break; 3034 case IDC_EMAIL_PAGE_LOCATION: EmailPageLocation(); break;
3035 case IDC_PRINT: Print(); break; 3035 case IDC_PRINT: Print(); break;
3036 case IDC_ADVANCED_PRINT: AdvancedPrint(); break; 3036 case IDC_ADVANCED_PRINT: AdvancedPrint(); break;
3037 case IDC_CHROME_TO_MOBILE_PAGE: ChromeToMobile(); break;
3037 case IDC_ENCODING_AUTO_DETECT: ToggleEncodingAutoDetect(); break; 3038 case IDC_ENCODING_AUTO_DETECT: ToggleEncodingAutoDetect(); break;
3038 case IDC_ENCODING_UTF8: 3039 case IDC_ENCODING_UTF8:
3039 case IDC_ENCODING_UTF16LE: 3040 case IDC_ENCODING_UTF16LE:
3040 case IDC_ENCODING_ISO88591: 3041 case IDC_ENCODING_ISO88591:
3041 case IDC_ENCODING_WINDOWS1252: 3042 case IDC_ENCODING_WINDOWS1252:
3042 case IDC_ENCODING_GBK: 3043 case IDC_ENCODING_GBK:
3043 case IDC_ENCODING_GB18030: 3044 case IDC_ENCODING_GB18030:
3044 case IDC_ENCODING_BIG5HKSCS: 3045 case IDC_ENCODING_BIG5HKSCS:
3045 case IDC_ENCODING_BIG5: 3046 case IDC_ENCODING_BIG5:
3046 case IDC_ENCODING_KOREAN: 3047 case IDC_ENCODING_KOREAN:
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 TabContentsWrapper::GetCurrentWrapperForContents(web_contents); 4015 TabContentsWrapper::GetCurrentWrapperForContents(web_contents);
4015 4016
4016 if (CommandLine::ForCurrentProcess()->HasSwitch( 4017 if (CommandLine::ForCurrentProcess()->HasSwitch(
4017 switches::kEnableWebsiteSettings)) { 4018 switches::kEnableWebsiteSettings)) {
4018 window()->ShowWebsiteSettings(profile, wrapper, url, ssl, show_history); 4019 window()->ShowWebsiteSettings(profile, wrapper, url, ssl, show_history);
4019 } else { 4020 } else {
4020 window()->ShowPageInfo(profile, url, ssl, show_history); 4021 window()->ShowPageInfo(profile, url, ssl, show_history);
4021 } 4022 }
4022 } 4023 }
4023 4024
4025 void Browser::ChromeToMobile() {
4026 // Only show the bubble if the window is active, otherwise we may get into
4027 // weird situations where the bubble is deleted as soon as it is shown.
4028 if (window_->IsActive())
4029 window_->ShowChromeToMobileBubble();
4030 }
4031
4024 void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) { 4032 void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) {
4025 DCHECK(source); 4033 DCHECK(source);
4026 TabContentsWrapper* wrapper = GetTabContentsWrapperAt( 4034 TabContentsWrapper* wrapper = GetTabContentsWrapperAt(
4027 tab_handler_->GetTabStripModel()->GetWrapperIndex(source)); 4035 tab_handler_->GetTabStripModel()->GetWrapperIndex(source));
4028 ViewSource(wrapper); 4036 ViewSource(wrapper);
4029 } 4037 }
4030 4038
4031 void Browser::ViewSourceForFrame(WebContents* source, 4039 void Browser::ViewSourceForFrame(WebContents* source,
4032 const GURL& frame_url, 4040 const GURL& frame_url,
4033 const std::string& frame_content_state) { 4041 const std::string& frame_content_state) {
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
5646 ShowSingletonTabOverwritingNTP(params); 5654 ShowSingletonTabOverwritingNTP(params);
5647 } else { 5655 } else {
5648 LoginUIServiceFactory::GetForProfile( 5656 LoginUIServiceFactory::GetForProfile(
5649 profile()->GetOriginalProfile())->ShowLoginUI(); 5657 profile()->GetOriginalProfile())->ShowLoginUI();
5650 } 5658 }
5651 } 5659 }
5652 5660
5653 void Browser::ToggleSpeechInput() { 5661 void Browser::ToggleSpeechInput() {
5654 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); 5662 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput();
5655 } 5663 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698