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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 6837021: Disable bookmark editing (views UI). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index cd1ed23dfe718ea9f82691093e65d11a1d389c2f..78e08519b59d7000f833a3c94b93ba6c6a15f2c1 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -33,6 +33,7 @@
#include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
#include "chrome/browser/ui/views/location_bar/star_view.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/pref_names.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/common/notification_service.h"
#include "grit/generated_resources.h"
@@ -124,6 +125,9 @@ LocationBarView::LocationBarView(Profile* profile,
if (mode_ == NORMAL)
painter_.reset(new views::HorizontalPainter(kNormalModeBackgroundImages));
+
+ edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled,
+ profile_->GetPrefs(), this);
}
LocationBarView::~LocationBarView() {
@@ -266,7 +270,8 @@ SkColor LocationBarView::GetColor(ToolbarModel::SecurityLevel security_level,
}
void LocationBarView::Update(const TabContents* tab_for_state_restoring) {
- bool star_enabled = star_view_ && !model_->input_in_progress();
+ bool star_enabled = star_view_ && !model_->input_in_progress() &&
+ edit_bookmarks_enabled_.GetValue();
command_updater_->UpdateCommandEnabled(IDC_BOOKMARK_PAGE, star_enabled);
if (star_view_)
star_view_->SetVisible(star_enabled);
@@ -1185,6 +1190,16 @@ void LocationBarView::OnTemplateURLModelChanged() {
ShowFirstRunBubble(bubble_type_);
}
+void LocationBarView::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type.value == NotificationType::PREF_CHANGED) {
+ std::string* name = Details<std::string>(details).ptr();
+ if (*name == prefs::kEditBookmarksEnabled)
+ Update(NULL);
+ }
+}
+
#if defined(OS_WIN)
bool LocationBarView::HasValidSuggestText() const {
return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698