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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 405
406 show_url_animation_.reset(new gfx::SlideAnimation(this)); 406 show_url_animation_.reset(new gfx::SlideAnimation(this));
407 show_url_animation_->SetTweenType(kShowTweenType); 407 show_url_animation_->SetTweenType(kShowTweenType);
408 show_url_animation_->SetSlideDuration(200); 408 show_url_animation_->SetSlideDuration(200);
409 409
410 hide_url_animation_.reset(new gfx::SlideAnimation(this)); 410 hide_url_animation_.reset(new gfx::SlideAnimation(this));
411 hide_url_animation_->SetTweenType(kHideTweenType); 411 hide_url_animation_->SetTweenType(kHideTweenType);
412 hide_url_animation_->SetSlideDuration(175); 412 hide_url_animation_->SetSlideDuration(175);
413 413
414 content::Source<Profile> profile_source = content::Source<Profile>(profile()); 414 content::Source<Profile> profile_source = content::Source<Profile>(profile());
415 registrar_.Add(
416 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source);
417 registrar_.Add(this, 415 registrar_.Add(this,
418 chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 416 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
417 profile_source);
418 registrar_.Add(this,
419 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
419 profile_source); 420 profile_source);
420 421
421 // Initialize the location entry. We do this to avoid a black flash which is 422 // Initialize the location entry. We do this to avoid a black flash which is
422 // visible when the location entry has just been initialized. 423 // visible when the location entry has just been initialized.
423 Update(NULL); 424 Update(NULL);
424 } 425 }
425 426
426 bool LocationBarView::IsInitialized() const { 427 bool LocationBarView::IsInitialized() const {
427 return omnibox_view_ != NULL; 428 return omnibox_view_ != NULL;
428 } 429 }
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after
1209 i != page_action_views_.end(); ++i) { 1210 i != page_action_views_.end(); ++i) {
1210 (*i)->UpdateVisibility( 1211 (*i)->UpdateVisibility(
1211 GetToolbarModel()->input_in_progress() ? NULL : web_contents, url); 1212 GetToolbarModel()->input_in_progress() ? NULL : web_contents, url);
1212 1213
1213 // Check if the visibility of the action changed and notify if it did. 1214 // Check if the visibility of the action changed and notify if it did.
1214 ExtensionAction* action = (*i)->image_view()->page_action(); 1215 ExtensionAction* action = (*i)->image_view()->page_action();
1215 if (old_visibility.find(action) == old_visibility.end() || 1216 if (old_visibility.find(action) == old_visibility.end() ||
1216 old_visibility[action] != (*i)->visible()) { 1217 old_visibility[action] != (*i)->visible()) {
1217 changed = true; 1218 changed = true;
1218 content::NotificationService::current()->Notify( 1219 content::NotificationService::current()->Notify(
1219 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, 1220 extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
1220 content::Source<ExtensionAction>(action), 1221 content::Source<ExtensionAction>(action),
1221 content::Details<WebContents>(web_contents)); 1222 content::Details<WebContents>(web_contents));
1222 } 1223 }
1223 } 1224 }
1224 } 1225 }
1225 return changed; 1226 return changed;
1226 } 1227 }
1227 1228
1228 bool LocationBarView::RefreshZoomView() { 1229 bool LocationBarView::RefreshZoomView() {
1229 DCHECK(zoom_view_); 1230 DCHECK(zoom_view_);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 Layout(); 1377 Layout();
1377 SchedulePaint(); 1378 SchedulePaint();
1378 } 1379 }
1379 } 1380 }
1380 1381
1381 void LocationBarView::UpdatePageActions() { 1382 void LocationBarView::UpdatePageActions() {
1382 size_t count_before = page_action_views_.size(); 1383 size_t count_before = page_action_views_.size();
1383 bool changed = RefreshPageActionViews(); 1384 bool changed = RefreshPageActionViews();
1384 if (page_action_views_.size() != count_before) { 1385 if (page_action_views_.size() != count_before) {
1385 content::NotificationService::current()->Notify( 1386 content::NotificationService::current()->Notify(
1386 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, 1387 extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED,
1387 content::Source<LocationBar>(this), 1388 content::Source<LocationBar>(this),
1388 content::NotificationService::NoDetails()); 1389 content::NotificationService::NoDetails());
1389 } 1390 }
1390 1391
1391 if (changed) { 1392 if (changed) {
1392 Layout(); 1393 Layout();
1393 SchedulePaint(); 1394 SchedulePaint();
1394 } 1395 }
1395 } 1396 }
1396 1397
1397 void LocationBarView::InvalidatePageActions() { 1398 void LocationBarView::InvalidatePageActions() {
1398 size_t count_before = page_action_views_.size(); 1399 size_t count_before = page_action_views_.size();
1399 DeletePageActionViews(); 1400 DeletePageActionViews();
1400 if (page_action_views_.size() != count_before) { 1401 if (page_action_views_.size() != count_before) {
1401 content::NotificationService::current()->Notify( 1402 content::NotificationService::current()->Notify(
1402 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, 1403 extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED,
1403 content::Source<LocationBar>(this), 1404 content::Source<LocationBar>(this),
1404 content::NotificationService::NoDetails()); 1405 content::NotificationService::NoDetails());
1405 } 1406 }
1406 } 1407 }
1407 1408
1408 void LocationBarView::UpdateOpenPDFInReaderPrompt() { 1409 void LocationBarView::UpdateOpenPDFInReaderPrompt() {
1409 open_pdf_in_reader_view_->Update( 1410 open_pdf_in_reader_view_->Update(
1410 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents()); 1411 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents());
1411 Layout(); 1412 Layout();
1412 SchedulePaint(); 1413 SchedulePaint();
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 ShowFirstRunBubble(); 1742 ShowFirstRunBubble();
1742 } 1743 }
1743 1744
1744 //////////////////////////////////////////////////////////////////////////////// 1745 ////////////////////////////////////////////////////////////////////////////////
1745 // LocationBarView, private content::NotificationObserver implementation: 1746 // LocationBarView, private content::NotificationObserver implementation:
1746 1747
1747 void LocationBarView::Observe(int type, 1748 void LocationBarView::Observe(int type,
1748 const content::NotificationSource& source, 1749 const content::NotificationSource& source,
1749 const content::NotificationDetails& details) { 1750 const content::NotificationDetails& details) {
1750 switch (type) { 1751 switch (type) {
1751 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: 1752 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED:
1752 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: 1753 case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED:
1753 Update(NULL); 1754 Update(NULL);
1754 break; 1755 break;
1755 1756
1756 default: 1757 default:
1757 NOTREACHED() << "Unexpected notification."; 1758 NOTREACHED() << "Unexpected notification.";
1758 } 1759 }
1759 } 1760 }
1760 1761
1761 //////////////////////////////////////////////////////////////////////////////// 1762 ////////////////////////////////////////////////////////////////////////////////
1762 // LocationBarView, private SearchModelObserver implementation: 1763 // LocationBarView, private SearchModelObserver implementation:
1763 1764
1764 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1765 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1765 const SearchModel::State& new_state) { 1766 const SearchModel::State& new_state) {
1766 const bool visible = !GetToolbarModel()->input_in_progress() && 1767 const bool visible = !GetToolbarModel()->input_in_progress() &&
1767 new_state.voice_search_supported; 1768 new_state.voice_search_supported;
1768 if (mic_search_view_->visible() != visible) { 1769 if (mic_search_view_->visible() != visible) {
1769 mic_search_view_->SetVisible(visible); 1770 mic_search_view_->SetVisible(visible);
1770 Layout(); 1771 Layout();
1771 } 1772 }
1772 } 1773 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_popup.cc ('k') | chrome/browser/ui/views/toolbar/browser_action_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698