OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/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 3254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3265 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, | 3265 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, |
3266 current_tab->controller().CanViewSource()); | 3266 current_tab->controller().CanViewSource()); |
3267 // Instead of using GetURL here, we use url() (which is the "real" url of the | 3267 // Instead of using GetURL here, we use url() (which is the "real" url of the |
3268 // page) from the NavigationEntry because its reflects their origin rather | 3268 // page) from the NavigationEntry because its reflects their origin rather |
3269 // than the display one (returned by GetURL) which may be different (like | 3269 // than the display one (returned by GetURL) which may be different (like |
3270 // having "view-source:" on the front). | 3270 // having "view-source:" on the front). |
3271 NavigationEntry* active_entry = nc.GetActiveEntry(); | 3271 NavigationEntry* active_entry = nc.GetActiveEntry(); |
3272 bool is_savable_url = | 3272 bool is_savable_url = |
3273 SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()); | 3273 SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()); |
3274 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, is_savable_url); | 3274 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, is_savable_url); |
3275 command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, is_savable_url && | |
3276 SavePackage::IsSavableContents(current_tab->contents_mime_type())); | |
3277 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, | 3275 command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, |
3278 current_tab->ShouldDisplayURL() && current_tab->GetURL().is_valid()); | 3276 current_tab->ShouldDisplayURL() && current_tab->GetURL().is_valid()); |
3279 | 3277 |
| 3278 // Changing the encoding is not possible on Chrome-internal webpages. |
| 3279 bool is_chrome_internal = (active_entry ? |
| 3280 active_entry->url().SchemeIs(chrome::kChromeUIScheme) : false); |
| 3281 command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, |
| 3282 !is_chrome_internal && SavePackage::IsSavableContents( |
| 3283 current_tab->contents_mime_type())); |
| 3284 |
3280 // Show various bits of UI | 3285 // Show various bits of UI |
3281 // TODO(pinkerton): Disable app-mode in the model until we implement it | 3286 // TODO(pinkerton): Disable app-mode in the model until we implement it |
3282 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 | 3287 // on the Mac. Be sure to remove both ifdefs. http://crbug.com/13148 |
3283 #if !defined(OS_MACOSX) | 3288 #if !defined(OS_MACOSX) |
3284 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, | 3289 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, |
3285 web_app::IsValidUrl(current_tab->GetURL())); | 3290 web_app::IsValidUrl(current_tab->GetURL())); |
3286 #endif | 3291 #endif |
3287 UpdateZoomCommandsForTabState(); | 3292 UpdateZoomCommandsForTabState(); |
3288 } | 3293 } |
3289 | 3294 |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4046 } | 4051 } |
4047 | 4052 |
4048 bool Browser::IsPinned(TabContents* source) { | 4053 bool Browser::IsPinned(TabContents* source) { |
4049 int index = tabstrip_model_.GetIndexOfTabContents(source); | 4054 int index = tabstrip_model_.GetIndexOfTabContents(source); |
4050 if (index == TabStripModel::kNoTab) { | 4055 if (index == TabStripModel::kNoTab) { |
4051 NOTREACHED() << "IsPinned called for tab not in our strip"; | 4056 NOTREACHED() << "IsPinned called for tab not in our strip"; |
4052 return false; | 4057 return false; |
4053 } | 4058 } |
4054 return tabstrip_model_.IsTabPinned(index); | 4059 return tabstrip_model_.IsTabPinned(index); |
4055 } | 4060 } |
OLD | NEW |