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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/views/bookmarks/bookmark_bubble_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h"
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/bookmarks/bookmark_editor.h" 11 #include "chrome/browser/bookmarks/bookmark_editor.h"
12 #include "chrome/browser/bookmarks/bookmark_model.h" 12 #include "chrome/browser/bookmarks/bookmark_model.h"
13 #include "chrome/browser/bookmarks/bookmark_utils.h" 13 #include "chrome/browser/bookmarks/bookmark_utils.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
16 #include "chrome/browser/ui/browser_list.h" 16 #include "chrome/browser/ui/browser_list.h"
17 #include "chrome/browser/ui/views/bubble/bubble.h" 17 #include "chrome/browser/ui/views/bubble/bubble.h"
18 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
19 #include "content/browser/user_metrics.h" 19 #include "content/browser/user_metrics.h"
20 #include "content/common/notification_service.h" 20 #include "content/public/browser/notification_service.h"
21 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
22 #include "grit/theme_resources.h" 22 #include "grit/theme_resources.h"
23 #include "ui/base/keycodes/keyboard_codes.h" 23 #include "ui/base/keycodes/keyboard_codes.h"
24 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
25 #include "ui/base/resource/resource_bundle.h" 25 #include "ui/base/resource/resource_bundle.h"
26 #include "ui/gfx/canvas.h" 26 #include "ui/gfx/canvas.h"
27 #include "views/controls/button/text_button.h" 27 #include "views/controls/button/text_button.h"
28 #include "views/controls/label.h" 28 #include "views/controls/label.h"
29 #include "views/controls/link.h" 29 #include "views/controls/link.h"
30 #include "views/controls/textfield/textfield.h" 30 #include "views/controls/textfield/textfield.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // |bubble_| can be set to NULL in BubbleClosing when we close the bubble 96 // |bubble_| can be set to NULL in BubbleClosing when we close the bubble
97 // asynchronously. However, that can happen during the Show call above if the 97 // asynchronously. However, that can happen during the Show call above if the
98 // window loses activation while we are getting to ready to show the bubble, 98 // window loses activation while we are getting to ready to show the bubble,
99 // so we must check to make sure we still have a valid bubble before 99 // so we must check to make sure we still have a valid bubble before
100 // proceeding. 100 // proceeding.
101 if (!bookmark_bubble_) 101 if (!bookmark_bubble_)
102 return; 102 return;
103 bookmark_bubble_->set_bubble(bubble); 103 bookmark_bubble_->set_bubble(bubble);
104 bubble->SizeToContents(); 104 bubble->SizeToContents();
105 GURL url_ptr(url); 105 GURL url_ptr(url);
106 NotificationService::current()->Notify( 106 content::NotificationService::current()->Notify(
107 chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN, 107 chrome::NOTIFICATION_BOOKMARK_BUBBLE_SHOWN,
108 content::Source<Profile>(profile->GetOriginalProfile()), 108 content::Source<Profile>(profile->GetOriginalProfile()),
109 content::Details<GURL>(&url_ptr)); 109 content::Details<GURL>(&url_ptr));
110 bookmark_bubble_->BubbleShown(); 110 bookmark_bubble_->BubbleShown();
111 } 111 }
112 112
113 // static 113 // static
114 bool BookmarkBubbleView::IsShowing() { 114 bool BookmarkBubbleView::IsShowing() {
115 return bookmark_bubble_ != NULL; 115 return bookmark_bubble_ != NULL;
116 } 116 }
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 apply_edits_ = false; 310 apply_edits_ = false;
311 } 311 }
312 312
313 // We have to reset |bubble_| here, not in our destructor, because we'll be 313 // We have to reset |bubble_| here, not in our destructor, because we'll be
314 // destroyed asynchronously and the shown state will be checked before then. 314 // destroyed asynchronously and the shown state will be checked before then.
315 DCHECK(bookmark_bubble_ == this); 315 DCHECK(bookmark_bubble_ == this);
316 bookmark_bubble_ = NULL; 316 bookmark_bubble_ = NULL;
317 317
318 if (delegate_) 318 if (delegate_)
319 delegate_->BubbleClosing(bubble, closed_by_escape); 319 delegate_->BubbleClosing(bubble, closed_by_escape);
320 NotificationService::current()->Notify( 320 content::NotificationService::current()->Notify(
321 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, 321 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN,
322 content::Source<Profile>(profile_->GetOriginalProfile()), 322 content::Source<Profile>(profile_->GetOriginalProfile()),
323 NotificationService::NoDetails()); 323 content::NotificationService::NoDetails());
324 } 324 }
325 325
326 bool BookmarkBubbleView::CloseOnEscape() { 326 bool BookmarkBubbleView::CloseOnEscape() {
327 return delegate_ ? delegate_->CloseOnEscape() : true; 327 return delegate_ ? delegate_->CloseOnEscape() : true;
328 } 328 }
329 329
330 bool BookmarkBubbleView::FadeInOnShow() { 330 bool BookmarkBubbleView::FadeInOnShow() {
331 return false; 331 return false;
332 } 332 }
333 333
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 const BookmarkNode* new_parent = 409 const BookmarkNode* new_parent =
410 parent_model_.GetNodeAt(parent_combobox_->selected_item()); 410 parent_model_.GetNodeAt(parent_combobox_->selected_item());
411 if (new_parent != node->parent()) { 411 if (new_parent != node->parent()) {
412 UserMetrics::RecordAction( 412 UserMetrics::RecordAction(
413 UserMetricsAction("BookmarkBubble_ChangeParent")); 413 UserMetricsAction("BookmarkBubble_ChangeParent"));
414 model->Move(node, new_parent, new_parent->child_count()); 414 model->Move(node, new_parent, new_parent->child_count());
415 } 415 }
416 } 416 }
417 } 417 }
418 } 418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698