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

Side by Side Diff: chrome/browser/views/about_chrome_view.cc

Issue 193092: Replace a bunch of hardcoded URLs with constants from url_constants.h... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « chrome/browser/toolbar_model.cc ('k') | chrome/browser/views/task_manager_view.cc » ('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 (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/about_chrome_view.h" 5 #include "chrome/browser/views/about_chrome_view.h"
6 6
7 #include <commdlg.h> 7 #include <commdlg.h>
8 8
9 #include "app/gfx/canvas.h" 9 #include "app/gfx/canvas.h"
10 #include "app/gfx/color_utils.h" 10 #include "app/gfx/color_utils.h"
11 #include "app/l10n_util.h" 11 #include "app/l10n_util.h"
12 #include "app/resource_bundle.h" 12 #include "app/resource_bundle.h"
13 #include "base/file_version_info.h" 13 #include "base/file_version_info.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/win_util.h" 15 #include "base/win_util.h"
16 #include "base/word_iterator.h" 16 #include "base/word_iterator.h"
17 #include "chrome/browser/browser_list.h" 17 #include "chrome/browser/browser_list.h"
18 #include "chrome/browser/metrics/user_metrics.h" 18 #include "chrome/browser/metrics/user_metrics.h"
19 #include "chrome/browser/views/restart_message_box.h" 19 #include "chrome/browser/views/restart_message_box.h"
20 #include "chrome/common/chrome_constants.h" 20 #include "chrome/common/chrome_constants.h"
21 #include "chrome/common/url_constants.h"
21 #include "chrome/installer/util/install_util.h" 22 #include "chrome/installer/util/install_util.h"
22 #include "grit/chromium_strings.h" 23 #include "grit/chromium_strings.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "grit/locale_settings.h" 25 #include "grit/locale_settings.h"
25 #include "grit/theme_resources.h" 26 #include "grit/theme_resources.h"
26 #include "views/controls/textfield/textfield.h" 27 #include "views/controls/textfield/textfield.h"
27 #include "views/controls/throbber.h" 28 #include "views/controls/throbber.h"
28 #include "views/standard_layout.h" 29 #include "views/standard_layout.h"
29 #include "views/widget/widget.h" 30 #include "views/widget/widget.h"
30 #include "views/window/window.h" 31 #include "views/window/window.h"
31 #include "webkit/glue/webkit_glue.h" 32 #include "webkit/glue/webkit_glue.h"
32 33
33 namespace { 34 namespace {
34 // The pixel width of the version text field. Ideally, we'd like to have the 35 // The pixel width of the version text field. Ideally, we'd like to have the
35 // bounds set to the edge of the icon. However, the icon is not a view but a 36 // bounds set to the edge of the icon. However, the icon is not a view but a
36 // part of the background, so we have to hard code the width to make sure 37 // part of the background, so we have to hard code the width to make sure
37 // the version field doesn't overlap it. 38 // the version field doesn't overlap it.
38 const int kVersionFieldWidth = 195; 39 const int kVersionFieldWidth = 195;
39 40
40 // The URLs that you navigate to when clicking the links in the About dialog.
41 const wchar_t* const kAcknowledgements = L"about:credits";
42 const wchar_t* const kTOS = L"about:terms";
43
44 // These are used as placeholder text around the links in the text in the about 41 // These are used as placeholder text around the links in the text in the about
45 // dialog. 42 // dialog.
46 const wchar_t* kBeginLink = L"BEGIN_LINK"; 43 const wchar_t* kBeginLink = L"BEGIN_LINK";
47 const wchar_t* kEndLink = L"END_LINK"; 44 const wchar_t* kEndLink = L"END_LINK";
48 const wchar_t* kBeginLinkChr = L"BEGIN_LINK_CHR"; 45 const wchar_t* kBeginLinkChr = L"BEGIN_LINK_CHR";
49 const wchar_t* kBeginLinkOss = L"BEGIN_LINK_OSS"; 46 const wchar_t* kBeginLinkOss = L"BEGIN_LINK_OSS";
50 const wchar_t* kEndLinkChr = L"END_LINK_CHR"; 47 const wchar_t* kEndLinkChr = L"END_LINK_CHR";
51 const wchar_t* kEndLinkOss = L"END_LINK_OSS"; 48 const wchar_t* kEndLinkOss = L"END_LINK_OSS";
52 49
53 // The background bitmap used to draw the background color for the About box 50 // The background bitmap used to draw the background color for the About box
54 // and the separator line (this is the image we will draw the logo on top of). 51 // and the separator line (this is the image we will draw the logo on top of).
55 static const SkBitmap* kBackgroundBmp = NULL; 52 static const SkBitmap* kBackgroundBmp = NULL;
56 53
57 // Returns a substring from |text| between start and end. 54 // Returns a substring from |text| between start and end.
58 std::wstring StringSubRange(const std::wstring& text, size_t start, 55 std::wstring StringSubRange(const std::wstring& text, size_t start,
59 size_t end) { 56 size_t end) {
60 DCHECK(end > start); 57 DCHECK(end > start);
61 return text.substr(start, end - start); 58 return text.substr(start, end - start);
62 } 59 }
63 60
64 } // namespace 61 } // namespace
65 62
66 namespace browser { 63 namespace browser {
67 64
68 // Declared in browser_dialogs.h so that others don't need to depend on our .h. 65 // Declared in browser_dialogs.h so that others don't need to depend on our .h.
69 void ShowAboutChromeView(views::Widget* parent, 66 void ShowAboutChromeView(views::Widget* parent,
70 Profile* profile) { 67 Profile* profile) {
71 views::Window::CreateChromeWindow(parent->GetNativeView(), gfx::Rect(), 68 views::Window::CreateChromeWindow(parent->GetNativeView(), gfx::Rect(),
72 new AboutChromeView(profile))->Show(); 69 new AboutChromeView(profile))->Show();
73 } 70 }
74 71
75 } // namespace browser 72 } // namespace browser
76 73
77 //////////////////////////////////////////////////////////////////////////////// 74 ////////////////////////////////////////////////////////////////////////////////
78 // AboutChromeView, public: 75 // AboutChromeView, public:
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 return this; 689 return this;
693 } 690 }
694 691
695 //////////////////////////////////////////////////////////////////////////////// 692 ////////////////////////////////////////////////////////////////////////////////
696 // AboutChromeView, views::LinkController implementation: 693 // AboutChromeView, views::LinkController implementation:
697 694
698 void AboutChromeView::LinkActivated(views::Link* source, 695 void AboutChromeView::LinkActivated(views::Link* source,
699 int event_flags) { 696 int event_flags) {
700 GURL url; 697 GURL url;
701 if (source == terms_of_service_url_) 698 if (source == terms_of_service_url_)
702 url = GURL(kTOS); 699 url = GURL(chrome::kAboutTermsURL);
703 else if (source == chromium_url_) 700 else if (source == chromium_url_)
704 url = GURL(l10n_util::GetString(IDS_CHROMIUM_PROJECT_URL)); 701 url = GURL(l10n_util::GetString(IDS_CHROMIUM_PROJECT_URL));
705 else if (source == open_source_url_) 702 else if (source == open_source_url_)
706 url = GURL(kAcknowledgements); 703 url = GURL(chrome::kAboutCreditsURL);
707 else 704 else
708 NOTREACHED() << "Unknown link source"; 705 NOTREACHED() << "Unknown link source";
709 706
710 Browser* browser = BrowserList::GetLastActive(); 707 Browser* browser = BrowserList::GetLastActive();
711 browser->OpenURL(url, GURL(), NEW_WINDOW, PageTransition::LINK); 708 browser->OpenURL(url, GURL(), NEW_WINDOW, PageTransition::LINK);
712 } 709 }
713 710
714 //////////////////////////////////////////////////////////////////////////////// 711 ////////////////////////////////////////////////////////////////////////////////
715 // AboutChromeView, GoogleUpdateStatusListener implementation: 712 // AboutChromeView, GoogleUpdateStatusListener implementation:
716 713
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 827
831 // We have updated controls on the parent, so we need to update its layout. 828 // We have updated controls on the parent, so we need to update its layout.
832 View* parent = GetParent(); 829 View* parent = GetParent();
833 parent->Layout(); 830 parent->Layout();
834 831
835 // Check button may have appeared/disappeared. We cannot call this during 832 // Check button may have appeared/disappeared. We cannot call this during
836 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet. 833 // ViewHierarchyChanged because the |window()| pointer hasn't been set yet.
837 if (window()) 834 if (window())
838 GetDialogClientView()->UpdateDialogButtons(); 835 GetDialogClientView()->UpdateDialogButtons();
839 } 836 }
OLDNEW
« no previous file with comments | « chrome/browser/toolbar_model.cc ('k') | chrome/browser/views/task_manager_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698