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

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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 apply_edits_ = false; 311 apply_edits_ = false;
312 } 312 }
313 313
314 // We have to reset |bubble_| here, not in our destructor, because we'll be 314 // We have to reset |bubble_| here, not in our destructor, because we'll be
315 // destroyed asynchronously and the shown state will be checked before then. 315 // destroyed asynchronously and the shown state will be checked before then.
316 DCHECK(bookmark_bubble_ == this); 316 DCHECK(bookmark_bubble_ == this);
317 bookmark_bubble_ = NULL; 317 bookmark_bubble_ = NULL;
318 318
319 if (delegate_) 319 if (delegate_)
320 delegate_->BubbleClosing(bubble, closed_by_escape); 320 delegate_->BubbleClosing(bubble, closed_by_escape);
321 NotificationService::current()->Notify( 321 content::NotificationService::current()->Notify(
322 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN, 322 chrome::NOTIFICATION_BOOKMARK_BUBBLE_HIDDEN,
323 content::Source<Profile>(profile_->GetOriginalProfile()), 323 content::Source<Profile>(profile_->GetOriginalProfile()),
324 NotificationService::NoDetails()); 324 content::NotificationService::NoDetails());
325 } 325 }
326 326
327 bool BookmarkBubbleView::CloseOnEscape() { 327 bool BookmarkBubbleView::CloseOnEscape() {
328 return delegate_ ? delegate_->CloseOnEscape() : true; 328 return delegate_ ? delegate_->CloseOnEscape() : true;
329 } 329 }
330 330
331 bool BookmarkBubbleView::FadeInOnShow() { 331 bool BookmarkBubbleView::FadeInOnShow() {
332 return false; 332 return false;
333 } 333 }
334 334
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 const BookmarkNode* new_parent = 410 const BookmarkNode* new_parent =
411 parent_model_.GetNodeAt(parent_combobox_->selected_item()); 411 parent_model_.GetNodeAt(parent_combobox_->selected_item());
412 if (new_parent != node->parent()) { 412 if (new_parent != node->parent()) {
413 UserMetrics::RecordAction( 413 UserMetrics::RecordAction(
414 UserMetricsAction("BookmarkBubble_ChangeParent")); 414 UserMetricsAction("BookmarkBubble_ChangeParent"));
415 model->Move(node, new_parent, new_parent->child_count()); 415 model->Move(node, new_parent, new_parent->child_count());
416 } 416 }
417 } 417 }
418 } 418 }
419 } 419 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698