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

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

Issue 807053005: Use BrowserCommandController's logic uniformly for bookmark command enable/disable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: . Created 6 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/browser_command_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.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 // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2007 // SHAppBarMessage, which internally spawns a nested message loop.This 2007 // SHAppBarMessage, which internally spawns a nested message loop.This
2008 // makes it possible for us to end up here before window creation has 2008 // makes it possible for us to end up here before window creation has
2009 // completed, at which point window_ is NULL. See 94752 for details. 2009 // completed, at which point window_ is NULL. See 94752 for details.
2010 2010
2011 if (window() && window()->GetLocationBar()) 2011 if (window() && window()->GetLocationBar())
2012 window()->GetLocationBar()->UpdatePageActions(); 2012 window()->GetLocationBar()->UpdatePageActions();
2013 } 2013 }
2014 2014
2015 void Browser::OnExtensionLoaded(content::BrowserContext* browser_context, 2015 void Browser::OnExtensionLoaded(content::BrowserContext* browser_context,
2016 const extensions::Extension* extension) { 2016 const extensions::Extension* extension) {
2017 chrome::UpdateCommandEnabled( 2017 command_controller_->ExtensionStateChanged();
2018 this,
2019 IDC_BOOKMARK_PAGE,
2020 !chrome::ShouldRemoveBookmarkThisPageUI(profile_));
2021 chrome::UpdateCommandEnabled(
2022 this,
2023 IDC_BOOKMARK_ALL_TABS,
2024 !chrome::ShouldRemoveBookmarkOpenPagesUI(profile_));
2025 } 2018 }
2026 2019
2027 void Browser::OnExtensionUnloaded( 2020 void Browser::OnExtensionUnloaded(
2028 content::BrowserContext* browser_context, 2021 content::BrowserContext* browser_context,
2029 const extensions::Extension* extension, 2022 const extensions::Extension* extension,
2030 extensions::UnloadedExtensionInfo::Reason reason) { 2023 extensions::UnloadedExtensionInfo::Reason reason) {
2031 chrome::UpdateCommandEnabled( 2024 command_controller_->ExtensionStateChanged();
2032 this,
2033 IDC_BOOKMARK_PAGE,
2034 !chrome::ShouldRemoveBookmarkThisPageUI(profile_));
2035 chrome::UpdateCommandEnabled(
2036 this,
2037 IDC_BOOKMARK_ALL_TABS,
2038 !chrome::ShouldRemoveBookmarkOpenPagesUI(profile_));
2039 if (window()->GetLocationBar()) 2025 if (window()->GetLocationBar())
2040 window()->GetLocationBar()->UpdatePageActions(); 2026 window()->GetLocationBar()->UpdatePageActions();
2041 2027
2042 // Close any tabs from the unloaded extension, unless it's terminated, 2028 // Close any tabs from the unloaded extension, unless it's terminated,
2043 // in which case let the sad tabs remain. 2029 // in which case let the sad tabs remain.
2044 if (reason != extensions::UnloadedExtensionInfo::REASON_TERMINATE) { 2030 if (reason != extensions::UnloadedExtensionInfo::REASON_TERMINATE) {
2045 // Iterate backwards as we may remove items while iterating. 2031 // Iterate backwards as we may remove items while iterating.
2046 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) { 2032 for (int i = tab_strip_model_->count() - 1; i >= 0; --i) {
2047 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i); 2033 WebContents* web_contents = tab_strip_model_->GetWebContentsAt(i);
2048 // Two cases are handled here: 2034 // Two cases are handled here:
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
2522 if (contents && !allow_js_access) { 2508 if (contents && !allow_js_access) {
2523 contents->web_contents()->GetController().LoadURL( 2509 contents->web_contents()->GetController().LoadURL(
2524 target_url, 2510 target_url,
2525 content::Referrer(), 2511 content::Referrer(),
2526 ui::PAGE_TRANSITION_LINK, 2512 ui::PAGE_TRANSITION_LINK,
2527 std::string()); // No extra headers. 2513 std::string()); // No extra headers.
2528 } 2514 }
2529 2515
2530 return contents != NULL; 2516 return contents != NULL;
2531 } 2517 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_command_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698